FsRenMovFile
FsRenMovFile is called to transfer (copy or move) a file within the plugin's file system.
Declaration:
int __stdcall FsRenMovFile(char* OldName, char* NewName, BOOL Move, BOOL OverWrite, RemoteInfoStruct* ri);
Description of parameters:
OldName Name of the remote source file, with full path. The name always starts with a backslash, then the names returned by FsFindFirst/FsFindNext separated by backslashes.
NewName Name of the remote destination file, with full path. The name always starts with a backslash, then the names returned by FsFindFirst/FsFindNext separated by backslashes.
Move If true, the file needs to be moved to the new location and name. Many file systems allow to rename/move a file without actually moving any of its data, only the pointer to it.
OverWrite Tells the function whether it should overwrite the target file or not. See notes below on how this parameter is used.
ri A structure of type
RemoteInfoStruct which contains the parameters of the file being renamed/moved (not of the target file!). In TC 5.51, the fields are set as follows for directories: SizeLow=0, SizeHigh=0xFFFFFFFF.
Return value:
Return one of the following values:
FS_FILE_OK The file was copied/moved OK
FS_FILE_EXISTS The target file already exists
FS_FILE_NOTFOUND The source file couldn't be found or opened.
FS_FILE_READERROR There was an error reading from the source file
FS_FILE_WRITEERROR There was an error writing to the target file, e.g. disk full
FS_FILE_USERABORT Copying was aborted by the user (through ProgressProc)
FS_FILE_NOTSUPPORTED The operation is not supported (e.g. resume)
FS_FILE_EXISTSRESUMEALLOWED not used here
Important notes:
Total Commander usually calls this function twice:
- once with OverWrite==false. If the remote file exists, return FS_FILE_EXISTS. If it doesn't exist, try to copy the file, and return an appropriate error code.
- a second time with OverWrite==true, if the user chose to overwrite the file.
While copying the file, but at least at the beginning and the end, call ProgressProc to show the copy progress and allow the user to abort the operation.