Copy File Action

Description

Copies files from the source path to the destination path. To specify more than one file use wildcard characters (* or ?). To specify multiple files or wildcard masks, separate them with a pipe symbol (|). e.g.: c:\*.txt|c:\*.bak. This action can be used to back-up files or complete directory structures, or send files to other computers across a network.

Declaration

<AMFILECOPY SOURCE="text" DEST="text" SUBFOLDERS="yes/no" EMPTYFOLDERS="yes/no" OVERWRITE="yes/no" ISNEWER="yes/no" ONLYFOLDERSTRUCT="yes/no" OVERWRITEREADONLY="yes/no" OVERWRITEHIDDEN="yes/no" ONLYIFEXIST="yes/no" ISNEWERTHAN="date" ISOLDERTHAN="date" ARCHIVETURNOFF="yes/no" EXCLUDE="text" ATTRFILTER="text"RESULTDATASET="text">

Examples

<AMFILECOPY SOURCE="C:\Folder1\*.*" DEST="C:\Folder2" SUBFOLDERS="YES" KEEPFOLDERSTRUCT="NO" OVERWRITE="YES"  RESULTDATASET="FileCopyDataset" />

 

<AMFILECOPY SOURCE="C:\Folder1\*.*" DEST="C:\Folder2" SUBFOLDERS="YES" OVERWRITE="YES" ISNEWER="YES" OVERWRITEREADONLY="YES" ONLYIFEXIST="YES" ISNEWERTHAN="%DateSerial(2007,02,24) + TimeSerial(15,40,34)%" ARCHIVETURNOFF="YES" EXCLUDE="*.pri" ATTRFILTER="+a-s" RESULTDATASET="FileCopyDataset" />

General Tab Parameters

Source: Specifies the files to copy. This can be a fully qualified path and file name (preferred) or a file name only (requires use of the Change Folder action). Wildcard characters (* or ?) may be used to copy files matching a certain mask. Multiple files and file masks may be specified by separating the entries with a pipe symbol (|).

Text, Required
MARKUP:
a) SOURCE="c:\sourcefoldername\file.txt"
b) SOURCE="c:\sourcefoldername\*.txt"
c) SOURCE="C:\sourcefoldername\*.txt|C:\sourcefoldername\*.doc"
d) SOURCE="file.txt"

Destination: Specifies the destination folder and (optionally) the file name for the file or files being copied. This can be a fully qualified path or a file name. If a file name only is specified, files are copied to the current folder as set by a previous Change Folder step. Folders that do not exist will be automatically created at runtime.

Text, Required
MARKUP:
a) DEST="c:\sourcefoldername\file.txt"
b) DEST="c:\sourcefoldername\*.txt"
c) DEST="file.txt"

Create and populate dataset with result information: Specifies the name of a dataset to be created and populated with the result. In addition to the standard dataset fields, the dataset will contain the following:

  • Source: the path and file name of the source file

  • Destination: the path and file name of the destination file

  • Result: the result of the action—0 for success, or an error code for failure

  • Message: textual information about the result

Text, Optional
MARKUP: RESULTDATASET="DatasetName"

Options Tab

Include Subfolders: When set to YES (selected), specifies that, if present, subfolders should be searched for files matching the mask specified in the Source [SOURCE] parameter

Yes/No, Optional, Default: NO
MARKUP: SUBFOLDERS="YES"

Preserve folder structure: Valid only if the Include subfolder [SUBFOLDERS] parameter is YES. When set to YES (selected), specifies that subfolders found in the source folder should be created in the destination folder and source files should be copied into their respective folders rather than directly into the root of the target folder specified in the Destination [DEST] parameter. If the Include subfolders [SUBFOLDERS] parameter is set to NO this parameter is ignored.

Yes/No, Optional, Default: YES
MARKUP: KEEPFOLDERSTRUCT="NO"

Include empty subfolders: Valid only if the Include subfolder [SUBFOLDERS] parameter is YES. When set to YES (selected), specifies that subfolders found in the source folder should be created in the destination folder even if they do not contain any files.

Yes/No, Optional, Default: NO
MARKUP: EMPTYFOLDERS="YES"

Only folder structure: Valid only if the Include subfolder [SUBFOLDERS] parameter is YES. When set to YES (selected), specifies that subfolders found in the source folder should be created in the destination folder but no files will be copied. Enabling this option causes any file-specific parameters to be ignored.

Yes/No, Optional, Default: NO
MARKUP: ONLYFOLDERSTRUCT="YES"

Overwrite if exist: When set to YES (selected), specifies that, if files already exist in the destination folder, they should be overwritten.

Yes/No, Optional, Default: NO
MARKUP: OVERWRITE="YES"

Only if newer: Valid only if the Overwrite if exist [OVERWRITE] parameter is YES. When set to YES (selected), specifies that only files that are newer than those in the destination folders will overwrite existing files

Yes/No, Optional, Default: NO
MARKUP: ISNEWER="YES"

Only if exist in destination: Valid only if the Overwrite if exist [OVERWRITE] parameter is YES. When set to YES (selected), specifies that only files that already exist in the destination will be copied from the source. All other files, regardless of whether they match the mask or other parameter settings will be bypassed.

Yes/No, Optional, Default: NO
MARKUP: ONLYIFEXIST="YES"

Overwrite read-only files: Valid only if the Overwrite if exist [OVERWRITE] parameter is YES. When set to YES (selected), specifies that already existing files should be overwritten even if the file in the destination is marked with the read-only attribute. By default, read only files are not overwritten.

Yes/No, Optional, Default: NO
MARKUP: OVERWRITEREADONLY="YES"

Overwrite hidden files: Valid only if the Overwrite if exist [OVERWRITE] parameter is YES. When set to YES (selected), specifies that already existing files should be overwritten even if the file in the destination is marked with the hidden attribute. By default, hidden files are bypassed.

Yes/No, Optional, Default: NO
MARKUP: OVERWRITEHIDDEN="YES"

Turn archive attribute off: When set to YES (selected), specifies that the archive attribute of the source files should be switched OFF. The Windows archive attribute is generally used to track whether a file has been backed-up; turning the source file's archive attribute off indicates to many backup programs that the file has already been backed-up.

Yes/No, Optional, Default: NO
MARKUP: ARCHIVETURNOFF="YES"

Exclude mask: Causes the action to not copy files matching the masks specified. Filenames or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe symbol (|), for example: *.txt|*.bak

Text, Optional, Default: (blank)
MARKUP: EXCLUDE="*.txt"

Only if newer than: Causes the action to only copy files if the source is newer than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding Only if newer [ISNEWER] parameter).

Date, Optional, Default: (none)
MARKUP: ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Only if older than: Causes the action to only copy files if the source is older than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding Only if newer [ISNEWER] parameter).

Date, Optional, Default: (none)
MARKUP: ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Click Custom to select from other time options (Last 30 seconds, Last 30 minutes, Last 24 hours, Last 30 Days, Last 12 Months, Last 5 Years, Next 30 Seconds, Next 30 Minutes, Next 24 Hours, Next 30 Days, Next 12 Months, Next 5 Years). A expression appears in the text box (e.g., %DateAdd( "s", -30, CStr( Now() ))%) and the Expression check box is selected. You can also click the Expression Builder icon to build a custom expression.

Attributes Tab

Attributes: This group of settings causes the action to filter which files are copied based on the attribute settings of the source files. In visual mode, a group of controls are provided to assist in the selection of this parameter. In markup mode, a single text item must be specified that contains the attributes of the files you wish to copy. The available options are:

  • R—Read only: Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • A—Archive: Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • S—System: Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • H—Hidden: Specifying "+H" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • C—Compression: Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

Text, Optional (blank)
MARKUP:
ATTRFILTER="+R+A-S-H" (move read-only and archive files, not system or hidden)
ATTRFILTER="-S" (do not move "system" files)