Error getting tags :
error 404Error getting tags :
error 404 revCopyFile | revDocs | RunRev
Welcome Guest (Log in)
Product Edition
Version
revCopyFile
Basics
Expander triangle
Type
Command
Syntax

revCopyFile fileToCopy,folderToCopyTo

Introduced
1.1.1
Environment
Desktop, Web and Server
Platform Support
MacOS,Mac OS X,Windows,Linux
Security
None required
Summary
Copies a file.
Examples

revCopyFile "/Disk/myfile","/Disk/Folder/"
revCopyFile "data/settings.txt","olddata"
trd, itrd, itrd, itrd, itrd, itrd, itrd, it

Additional Comments
Expander triangle

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

Parameters:

The fileToCopy specifies the name and location of the file. If you specify a name but not a location, Revolution assumes the file is in the defaultFolder.

The folderToCopyTo specifies the name and location of the folder where the copied file should be placed. If you specify a name but not a location, Revolution assumes the destination folder is in the defaultFolder.

Comments:

The revCopyFile command uses system services on each platform to perform 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.

Important! 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.

Note: 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 revCopyFilecommand is not yet available. This may affect attempts to use this command in startup, preOpenStack, openStack, or preOpenCardhandlers in the main stack. Once the application has finished starting up, the library is available and the revCopyFilecommand can be used in any handler.

User Comments
Expander triangle
User thumbnail
dvk@dvkconsult.com.au
StarStarStarStarStar
May 16, 2010
On OS X this does not create sub-folders missing from the target path. Not tested on other platforms. You may need to test iteratively for the existence of sub-folders (sub-directories) and create them as required. Note that "create folder" (or new directory) does nothing if the proposed folder/directory already exists, so a prior test is not essential.
User thumbnail
dvk@dvkconsult.com.au
StarStarStarStarStar
May 16, 2010
See also revCopyFolder if the problem is large scale copying.
User thumbnail
Malte Brill
StarStarStarStarStar
Sep 1, 2010
On a Mac (at least with X.6.4) revCopyFile needs an absolute path to the file to copy. Otherwise it breaks with Execution Error in the result.