Retrieves information (i.e. File Name, Extension, Creation time, Modified time) regarding one or more files and stores the results into a variable or dataset. To specify more than one file, use wildcard characters (i.e. * or ?). Commonly used to gather data about one or more files and perform conditional actions depending on the information.
Declaration
<AMGETFILEINFO FILE="text" RESULTVARIABLE="text" FILEPROPERTY="Text(options)" ISNEWERTHAN="date" />
Example 1 - Simple copy file operation.
<AMFILECOPY SOURCE="C:\Folder1\*.*" DEST="C:\Folder2" SUBFOLDERS="YES" KEEPFOLDERSTRUCT="NO" OVERWRITE="YES" RESULTDATASET="FileCopyDataset" />
Example 2 - Copy file(s) from "C:\Folder1\*.*" to "C:\Folder2\". Include sub folders. Exclude the file mask(s) "*.pri". Overwrite read-only files and files that exist in the destination. Create and populate dataset "FileCopyDataset" with details of the file(s) to be copied.
<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" />
See Also: Touch File, Copy File, Move File, Delete File, Delete Folder, Rename Folder, Write to File, Join File, Concatenate Files, About Datasets
Property |
Type |
Required |
Default |
Markup |
Description |
Source |
Text |
Yes |
(Empty) |
a)SOURCE="c:\sourcefolder\file.txt" b)SOURCE="c:\sourcefolder\*.txt" c)SOURCE="filename.txt" |
The file(s) from which information should be retrieved. 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 specify files matching a certain mask. |
Populate variable with result |
Text |
No |
(Empty) |
a)RESULTVARIABLE="theFileName.txt b)RESULTVARIABLE="fileA.txt;fileB.txt" |
If enabled, specifies the name of the variable to populated with the chosen file's information as specified in the File property parameter. If multiple files are specified, the variable will be populated with file property of each file separated by a semi colon. For example, if the file property selected is Filename, the variable will store information in this manner: fileA.txt;fileB.txt;fileC.txt, etc. |
File Property |
Text |
No |
Fullname |
FILEPROPERTY="Size" |
The file property with which to populate the variable. This parameter is available only when the Populate variable with result parameter is enabled. The available options are:
|
Dataset to populate |
Text |
No |
(Empty) |
RESULTDATASET="DatasetName" |
If enabled, specifies the name of the dataset to populate with all available information about one or more files. More about datasets |
Property |
Type |
Required |
Default |
Markup |
Description |
Include Subfolders |
Yes/No |
No |
No |
SUBFOLDERS="YES" |
If set to YES, denotes that, if present, subfolders should be searched for files matching the mask specified in the Source parameter. If set to NO (default value), subfolders are altogether ignored. |
Exclude Mask |
Text |
No |
(Empty) |
EXCLUDE="*.txt" |
Causes this action to omit files matching the mask(s) specified. File names or wildcard masks may be used. |
Regular Expression |
Yes/No |
No |
No |
RE="YES" |
If set to YES, specifies that the data entered in the Exclude Mask field is a regular expression. |
Only if Newer Than |
Date |
No |
(Empty) |
ISNEWERTHAN= "%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" |
Causes this action to only include files if the source is newer than the date/time specified. If this parameter is left blank or not included, the date of the files will be ignored. |
Only if Older Than |
Date |
No |
(Empty) |
ISOLDERTHAN= "%DateSerial(2001,10,12) + TimeSerial(00,00,00)%" |
Causes this action to only include files if the source is older than the date/time specified. If this parameter is left blank or not included, the date of the files will be ignored. |
Property |
Type |
Required |
Default |
Markup |
Description |
Attributes |
Text (Options) |
No |
(Empty) |
ATTRFILTER="+R+A-H" (copy read-only & archive files but not hidden files) |
This group of settings causes the action to filter which files should information be retrieved from based on the attribute settings of the source file(s). 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 want to copy. Available Options:
|
The Description tab allows you to customize the text description of any step as it appears in the Task Builder's Steps Pane.
More on setting custom step description
The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.
The On Error tab allows you to determine what the task should do if a particular step encounters an error.
More about On Error properties
All text fields allow the use of expressions, which can be entered by surrounding the expression in percentage signs (example: %MYVARIABLE%, % Left('Text',2)%). To help construct these expressions, you can open Expression Builder from these fields by pressing F2.