Copy File

The Copy File is a synchronous activity that you can use to copy files and directories to a new location.

General

The General tab has the following fields.

Field Literal Value/ Process Property/Module Property Description
Name None The name to be displayed as the label of the activity in the process.
From Filename Yes The path and name of the file or directory to copy.

For directories, you must specify an absolute path. You may use wildcards when specifying files within a directory.

For example, to copy a directory, specify c:\myDirectory. To copy all text files in a directory, specify c:\myDirectory\*.txt.

To Filename Yes The destination for the copy operation. This must be an absolute path.

Do not use wildcard characters in this element.

Overwrite Literal Value Select this check box to overwrite the existing file with the same name, if it exists.

The activity raises an exception if the specified file or directory exists and this check box is not selected.

Create Non-Existing Directories Literal Value When this check box is selected, the activity creates all directories in the specified path, if they do not already exist.

If this check box is not selected with non-existing one or more directories in the specified path, it displays an exception.

Include Sub-Directories Literal Value

Includes all sub-directories in the source directory, when the source to copy is a directory.

Description

Provide a short description for the activity.

Input

The following is the input for the activity.

Input Item Datatype Description
fromFileName string The path and name of the file or directory to copy.

For directories, specify an absolute path. You may use wildcards when specifying files within a directory. For example:

  • To copy a directory, specify c:\myDirectory.
  • To copy all text files in a directory, specify c:\myDirectory\*.txt.
toFileName string The destination for the copy operation. This must be an absolute path and wildcards cannot be used in this element.
Note: The Input field always takes precedence for all File palette activities with respect to the field equivalent on the General tab.

Fault

The Fault tab lists the possible exceptions generated by this activity. For more information about error codes and the corrective action to take, see the TIBCO BusinessWorks™ Container Edition Error Codes guide.

Fault Generated When..
FileNotFoundException The file does not exist. The source file or the destination is not found and the Create Non-Existing Directories check box is not selected on the General tab.
IllegalCopyException The destination exists but its type is different than the type of the specified source.

For example, in the activity input, fromFileName is a directory and toFileName is a file.

FileAlreadyExistsException The file already exists at the destination where you are attempting to copy the file and the Overwrite field is not selected on the General tab.
FileIOException There is an input/output error. For example, the file or directory already exists and it is write-protected.