Deutsches LiveCode Wiki
Advertisement

Copies a file. Syntax:

revCopyFile <fileToCopy>, <folderToCopyTo>

Examples:

revCopyFile "/Disk/myfile","/Disk/Folder/"
revCopyFile "data/settings.txt","olddata"
revCopyFile the sourceFile of this card, it

Use the revCopyFile command to make a copy of a file(keyword) to another folder.

Use this command to copy a bundle on OS X systems

You can also copy a file using the put command, in a statement like the following:

put URL "binfile:/Disk/myfile" into URL "binfile:/Disk/Folder/myfile" 

However, the revCopyFile command provides certain advantages. It copies file attributes (such as file type) and Mac OS resource forks along with the file. It also does not require reading the entire file into memory, so even extremely large files can be copied.

In a standalone application the Common library is implemented as a hidden group and made available when the group receives its first openBackground message. During the first part of the application's startup process, before this message is sent, the revCopyFile command is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCard handlers in the main stack. Once the application has finished starting up, the library is available and the revCopyFile command can be used in any handler.

Parameters:

  • fileToCopy: The fileToCopy specifies the name and location of the file. If youspecify a name but not a location, LiveCode assumes the file is in thedefaultFolder.
  • folderToCopyTo: The folderToCopyTo specifies the name and location of the folder wherethe copied file should be placed. If you specify a name but not alocation, LiveCode assumes the destination folder is in thedefaultFolder.
  • The result: The revCopyFile command uses system services on each platform toperform the copy. On Mac OS systems, it uses AppleScript; on OS X, Windows and Unix systems, it uses the shell function. Any errors encountered are returned in the result function.

See also: create alias (command), ,startup (message),openBackground (message),preOpenStack (message),openStack (message),preOpenCard (message),

Advertisement