The FILE_COPY procedure copies files, or directories of files, to a new location. The copies retain the permission settings of the original files, and belong to the user that performed the copy. See Rules Used By FILE_COPY for additional information.
FILE_COPY copies files based on their names. To copy data between open files, see the COPY_LUN procedure.
FILE_COPY, SourcePath, DestPath [, /ALLOW_SAME] [, /NOEXPAND_PATH] [, /OVERWRITE] [, /RECURSIVE] [, /REQUIRE_DIRECTORY] [, /VERBOSE]
UNIX-Only Keywords: [, /COPY_NAMED_PIPE] [, /COPY_SYMLINK] [, /FORCE]
A scalar string or string array containing the names of the files or directories to be copied.
| Note |
A scalar string or string array containing the names of the destinations to which the files and directories specified by SourcePath are to be copied. If more than one file is to be copied to a given destination, that destination must exist and be a directory.
Attempting to copy a file on top of itself by specifying the same file for SourcePath and DestPath is usually considered to be an error. If the ALLOW_SAME keyword is set, no copying is done and the operation is considered successful.
When FILE_COPY encounters a UNIX named pipe (also called a fifo) in SourcePath, it usually opens it as a regular file and attempts to copy data from it to the destination file. If COPY_NAMED_PIPE is set, FILE_COPY will instead replicate the pipe, creating a new named pipe at the destination using the system mkfifo() function.
When FILE_COPY encounters a UNIX symbolic link in SourcePath, it attempts to copy the file or directory pointed to by the link. If COPY_SYMLINK is set, FILE_COPY will instead create a symbolic link at the destination with the same name as the source symbolic link, and pointing to the same path as the source.
Even if the OVERWRITE keyword is set, FILE_COPY does not overwrite files that have their file permissions set to prevent it. If the FORCE keyword is set, such files are quietly removed to make way for the overwrite operation to succeed.
| Note |
Set this keyword to cause FILE_COPY to use SourcePath and DestPath exactly as specified, without expanding any wildcard characters or environment variable names included in the paths. See FILE_SEARCH for details on path expansion.
Set this keyword to allow FILE_COPY to overwrite an existing file.
Set this keyword to cause directories specified by SourcePath to be copied to DestPath recursively, preserving the hierarchy and names of the files from the source. If SourcePath includes one or more directories, the RECURSIVE keyword must be set.
| Note |
Set this keyword to cause FILE_COPY to require that DestPath exist and be a directory.
Set this keyword to cause FILE_COPY to issue an informative message for every file copy operation it carries out.
The following rules govern how FILE_COPY operates:
Make a backup copy of a file named myroutine.pro in the current working directory:
FILE_COPY, 'myroutine.pro', 'myroutine.pro.backup'
Create a subdirectory named BACKUP in the current working directory and copy all .pro files, makefile, and mydata.dat into it:
FILE_MKDIR, 'BACKUP' FILE_COPY, ['*.pro', 'makefile', 'mydata.dat'], 'BACKUP'
Introduced: 5.6
COPY_LUN, FILE_LINK, FILE_MOVE