3.3.2.20 File

Copy a file to another file.

Syntax:

file   option Path\FileName1 Path\FileName2

Options:

-c; Copy FileName1 to FileName2

Syntax: file -c Path\FileName1 Path\FileName2

Copy FileName1 to FileName2. If no path is specified, the Origin installation folder is used. Destination folder can be automatically created.

-cp; Copy Source File to Destination

Syntax: file -cp size srcpath [offset] [dest];

Copies a chunk of bytes of length size from srcpath file starting at [offset] and saves the chunk to [dest].

  • Size and offset in in bytes. Can use engineering notation like "5M" or "5Mb", 5M=5E6, while 5Mb = 5*1024*1024.
  • If option [offset] is not specified, copy starts from 1st byte.
  • If option [dest] is not specified, destination is User Files Folder (UFF).
  • Both srcpath and dest can be any string expression.

Examples:

file -c "%YOrigin.ini" STD.ini; //copies a User's INI file to the Origin Installation folder with a new name
//%Y is a string variable that holds the path of the User Files Folder.
file -cp 1024*3 "%Yorigin.ini";
dlgfile g:=*.csv;
file -cp 3Mb fname$;
string str1$="C:\temp\test1\test.txt";
string str2$="C:\temp\test2\test.txt";
type -v "copying from [%(str1$)] to [%(str2$)]";
@ERR=0;
file -c "%(str1$)" "%(str2$)";
@ERR=;//from system GetLastError if CopyFile failed.