Copy Files

The CopyFile task allows you to copy file(s) from a directory or an entire directory tree. The 'move' option deletes the original files after a successful copy operation. The 'rename' option renames the original file(s) to the new name(s).

Source Directory
Enter the full path name of the directory where your source files exists.  Note that the path is case sensitive for unix Ftp servers.

Target Directory
Enter the full path name of the directory where you need to put the target files.  Note that the path is case sensitive on unix systems.

Filename
For the Copy and Move options only, enter the name filter for the files you wish to copy  using the following wildcard rules . This field also supports dynamic variables.  Using dynamic variables, you can select a file based on current date/time in addition to the normal wildcard search.
For the Rename option, the above wildcard options only apply for the file to pass the filename filter.  If the file passes the filename filter, then its newly renamed name will depend on the Rename Filename field.

Rename Filename
The rename filename field entry is dependent on the filename field entry.
1) You should specify matching tokens in the Filename and Rename Filename field.
2) Multiple tokens should be separated by ^ .
3) If the filename field has more tokens than the rename filename field, then the first token of the rename filename field is used only.
4) If the rename filename field is blank, this option will act similar to the move option.
 

Consider the following files in folder = test.txt, temp.zip, temptest.txt
 
Filename field Rename Filename Field Rename results
.txt .doc test.doc, temptest.doc
.txt^.zip .doc^.jar test.doc, temp.jar, temptest.doc
temp^test bad bad.txt, bad.zip, badbad.txt
te bad badst.txt, badmp.zip, badmpbadst.txt
temp^test^.zip bad^.txt bad.txt, bad.bad, badbad.zip
.txt  (left blank) test.txt, temptest.txt  (same as move option)

Please note that when using the rename option, some dynamic variables like $%....::Filenames%$ will give unpredictable results because the there can be more than 1 filename returned by this variable.  i.e. There is no way to match the filename tokens with the rename filename tokens.

Place files in new subdirectory
If you select "None", no new subdirectory is created within the Target Directory.
If you select Date, a new subdirectory based on the date is created within the Target Directory. All files are placed in this directory.
If you select Date, a new subdirectory based on date and time is created within the Target Directory. All files are placed in this directory.

Include subdirectories
If you select this option, all subdirectories and files within the Source Directory are copied to the Target Directory.  If a subdirectory does not exist within the Target directory, then it is automatically created.

Append to Filename
If you are regularly coping a file and wish to save each copy to a different filename based on current time/date, choose the append file option which best suits your copying frequency and file naming needs.

Date Filter
If you need to filter files based on file modified date, select this option. For the between option, enter 2 values separated by '-' (2-4 etc..). Examples:
Older than 5 Minute, Newer than 2 Day, Between 3-5 Day, Between 1-4 Hour

Delete empty subfolders after Move
The move option first moves all files that meet the filename and other criteria.  By default, empty subfolders are not deleted after all files are moved out.  This is done by design, since many production systems may need these empty subfolders to remain in place, for other processes to move new files into these empty subfolders.
If you need to delete empty subfolders after the Files have been moved, select this option.  Please note that all empty subfolders in the source folder will be deleted, even if there were no files in those subfolders at the start of the move option.