Tag:File operation

  • Using go language to transfer files remotely

    Time:2020-5-27

    preface There was a previous article about how to use the go language to execute remote commands through SSH protocol: how to use the go language to implement remote command execution is the same as SSH protocol can also use the go language to transmit files remotely. In addition to the SSH Library, in order […]

  • Summary of VBScript file operation code

    Time:2020-3-5

    Create text file Copy codeThe code is as follows: Set objFSO = CreateObject(“Scripting.FileSystemObject”) Set objFile = objFSO.CreateTextFile(“C:\FSO\ScriptLog.txt”) Whether the procuratorial documents exist Copy codeThe code is as follows: Set objFSO = CreateObject(“Scripting.FileSystemObject”) If objFSO.FileExists(“C:\FSO\ScriptLog.txt”) Then Set objFolder = objFSO.GetFile(“C:\FSO\ScriptLog.txt”) Else Wscript.Echo “File does not exist.” End If Delete text file Copy codeThe code is as […]

  • Analysis of writing strings and arrays to PHP files

    Time:2020-2-4

    The example of this article describes the method of writing string and array to PHP files. To share with you for your reference, as follows: Scenario 1: use text documents to record some operation logs, because for some frequent operations, the amount of data recorded by operation is bound to be large, and using database […]

  • Summary of some common file operation methods in Ruby

    Time:2019-12-11

    You need to learn a lot when you start learning ruby. Now you start to use ruby to write a script, which uses a lot of file related operations. Here, I will sort out some of them in stages. Easy to find again. Does the file or directory exist Copy codeThe code is as follows: […]

  • Implementation of File Operation and Network Request in Scala

    Time:2019-10-8

    1. Read data for each line in the file def main(args: Array[String]): Unit = { // pay attention to the encoding format of the file. If the encoding format is not correct, read the wrong report. val file: BufferedSource = Source.fromFile(“F:\\files\\file.txt”,”GBK”); val lines: Iterator[String] = file.getLines() for(line <- lines){ println(line) } // Pay attention to […]

  • MFC file operation method for creating files of CFile class

    Time:2019-9-29

    MFC file operation class CFile Several constructors of CFile class CFile (); // Constructor with no parameters. CFile (int hFile); // Constructor with file handle parameters. CFile( LPCTSTR lpszFileName, // File Path to Open UINT nOpenFlage//Sharing and Access Mode when Opening Files ) Constructor with file path and open mode In addition to opening a […]

  • Summary of Perl File Operation

    Time:2019-9-15

    I. Open and Close Documents The return value of open is used to determine whether the operation of opening a file succeeds, returns a non-zero value when it succeeds, and returns zero when it fails, so the following judgment can be made:    if (open(MYFILE, “myfile”))     {        # here is what to do if the […]

  • Usual File Operating Methods in Ruby

    Time:2019-9-4

    I. New Documents Copy codeThe code is as follows:     f=File.new(File.join(“C:”,”Test.txt”), “w+”)     f.puts(“I am Jack”)     f.puts(“Hello World”) File mode “r” :Read-only. Starts at beginning of file (default mode). “r+” :Read-write. Starts at beginning of file. “w” :Write-only. Truncates existing file to zero length or creates a new file for writing. “w+” :Read-write. Truncates […]

  • FreeBSD File Operation

    Time:2019-6-2

    0.        PrefaceThe operation of files is the most commonly used instruction. It includes switching directories, listing files, establishing files, deleting files, copying files, renaming files, file permissions, file links, etc. 1. Toggle directoryDirective: CD (change diretory changes directory location of account)Syntax: CDdirectory_name   Parameter:. Represents the current directory. Represents the upper directory ~Represents the user’s […]

  • Several examples of Perl file operation

    Time:2019-5-26

    Perl uses the most places even file processing, below I summarize some things about Perl file operation, and there are specific examples, through the following examples, to enhance our understanding of Perl file operation. Delete files Use unlinke functions, such as unlink $file, unlink $file1, $file2, $file3 Open file Opening a file in the form […]

  • Summary of Document Operating Codes in Go Language

    Time:2019-4-20

    # Create and open files // New files can be created in two ways: func Create(name string) (file *File, err Error) Create a new file according to the file name provided, and return a file object. The default permission is 0666 file. The returned file object is readable and writable. func NewFile(fd uintptr, name string) […]

  • Summary of PHP File Operation Examples [File Upload, Download, Paging]

    Time:2019-4-19

    This article gives an example of PHP file operation. Share for your reference, as follows: 1. File upload Upload domain:input type=”file” Ordinary text boxes (text, password, textarea, radio, checkbox, etc.): Submit data to the server in the form of byte streams File: Submitting a file in binary encoding to the past is very simple to […]