If - Folder exists |
Declaration
<AMIF ACTIVITY="folder_exist" FOLDER="text" MODE="text (options)" SUBFOLDERS="yes/no" EXCLUDE="text" RE="yes/no" ISNEWERTHAN="date serial" ISOLDERTHAN="date serial" />
Description
Determines the existence of a folder and returns TRUE or FALSE depending on the outcome. If the result evaluates to TRUE, the task will execute the block of steps immediately following this step up until an End if step is encountered. If the result evaluates to FALSE, the block will be skipped and execution will proceed directly after the End if step (or if an Else step is encountered, the task will execute that block of steps instead, up until an End if step is encountered). This activity supports wildcard characters (that is, * or ?).
Practical Usage
Generally used to check if a folder exists (or does not exist) and execute conditional actions depending on the result.
Parameters
General
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
If | Text (Options) | Yes | Folder exists |
| Specifies
the type of evaluation to be performed. The available options
are:
|
Folder | Text | Yes | (Empty) | FOLDER="c:\foldername\" | Specifies path and name of the folder to evaluate. Wildcard characters (that is, * or ?) are supported. For example, to specify all folders that contain the word 'log', enter "c:\*log*\". |
File Options
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Include subfolders | Yes/No | No | No | SUBFOLDERS="YES" | If selected, denotes that, if present, subfolders should be searched for folders matching the mask specified in the Folder parameter. If disabled (default), subfolders are ignored. |
Exclude Mask | Text | No | (Empty) | EXCLUDE="*temp*" | Causes this activity to omit folders matching the mask specified. Folder names or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe symbol (|). |
Only if newer than | Date | No | (Empty) | ISNEWERTHAN="%DateSerial(2007,02,01) + TimeSerial(00,00,00)%" | Causes this activity to evaluate only folders with a creation date newer than the date / time specified. If this parameter is left blank or not included, the folder date will be ignored. |
Only if older than | Date | No | (Empty) | ISOLDERTHAN="%DateSerial(2007,02,01) + TimeSerial(00,00,00)%" | Causes this activity to evaluate only folders with a creation date older than the date / time specified. If this parameter is left blank or not included, the folder date will be ignored. |
File Filter
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Attributes | Text (options) | No | (Empty) | ATTRFILTER="+R+A-H" (compress read-only & archive files, but not hidden files) | This
group of settings causes the activity to filter which files to
look for based on the attribute settings of the source file.
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 look for. Available options are:
|
Example
- The sample AML code below can be copied and pasted directly into the Steps Panel of the Task Builder.
- Parameters containing user credentials, files, file paths, and/or other information specific to the task must be customized before the sample code can run successfully.
Description
Determines whether folder C:\Temp exists and displays the results in a message box.
<AMIF ACTIVITY="file_exist" FILE="c:\temp" />
<AMSHOWDIALOG MESSAGE="The file exists." />
<AMELSE />
<AMSHOWDIALOG MESSAGE="Folder does not exist" />
<AMIF ACTIVITY="end" />