Copying a file

copyfile()

Copy a file


SYNTAX

copyfile(destination_path, source_path, options)

Copy a file.

destination_path
source_path

The destination pathname and source pathname of the file to be copied. Either file can be on the server machine or a client machine.

options

Option flag(s). If more than one option is required they should be combined using the | operator. The available flags (listed in <sculptor.h> are:

COPY_BINARY

Copy a binary file.

COPY_TEXT

Copy a text file.

COPY_UPDATE

Copy only if the source file is newer than the destination file, or the destination file does not exist.

COPY_TIME

Give the destination file the same date and time accessed and modified as the source file.

COPY_MAKEPATH

If the directory specified in destination_path doesn’t currently exist, create it.

Either COPY_BINARY or COPY_TEXT should always be specified since Sculptor cannot at present determine the file type. This feature will be added in a future release.

This function returns one of the following values:

-1

Error encountered. The error number is stored in sys.Errno.

0

No need to copy file; the COPY_UPDATE flag was used and the source file was not newer.

1

File copied.


EXAMPLE

copyfile("server1:/data/trans", "data/trans", COPY_BINARY | COPY_UPDATE)

RELATED TOPICS

File and directory handling functions