|
FTP - Rename file(s) |
Declaration
<AMFTP ACTIVITY="rename" SOURCE="text" DEST="text" SUBFOLDERS="YES" OVERWRITE="YES" ONLYIFEXIST="YES/NO" MATCHCASE="YES/NO" EXCLUDE="text" RE="YES" SESSION="text" />
Description
Renames the files specified on the FTP server. This activity supports mutli-file renaming. To specify more than one file, use wildcards (for example, * or ? ). To specify multiple files or wildcard masks, separate them with a vertical bar (for example, *.txt|*.bak). See File Masks & Wildcards for more details.
Practical Usage
Renames one or more files during an established FTP session.
Parameters
Connection
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Session | Text | Yes | FTPSession | SESSION="SessionName" | Specifies the name of the originating session (created by a previous FTP - Logon step) in which to link this activity. This permits several FTP activities to be linked to a specific session, thus, allowing multiple simultaneous FTP operations to take place within a single task. |
File
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Remote Files | Text | Yes | (Empty) |
|
Indicates the files
to rename. Enter the file names manually
in the provided text box or click the folder icon to open the
FTP Browser
which allows connection to the server in order to browse available
files and folders. This can be a fully qualified UNIX style path and file name (preferred) or a single file (requires use of the FTP Change Folder action). Wildcards (for example, *.* or ?) may be used to rename files matching a certain mask. Multiple file and/or file masks may be specified by separating the entries with the "|" symbol (for example, /*.txt|/*.doc). See File Masks & Wildcards for more details. NOTE: Files with invalid paths are ignored at runtime. |
New Name | Text | Yes | (Empty) |
|
Specifies the new file names in which to rename the files specified in the Remote Files parameter. |
File Options
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Exclude mask | Text | No | (Empty) | EXCLUDE="*.txt" | Causes this activity to omit any files matching the masks specified. Filenames or wildcard masks (i.e. * or ?) may be used. Multiple entries may be specified by separating them with the"|" symbol (i.e. *.txt|*.bak). |
Regular expression | Yes/No | No | No | RE="YES" | Specifies whether the value in the Exclude Mask parameter is a regular expressions. Regular Expression, also referred to as regex or regexp, provide a concise and flexible means for matching strings of text. |
Include Subfolders | Yes/No | No | No | SUBFOLDERS="YES" | When selected, specifies that, if present, subfolders should be searched for files matching the mask specified in the Remote Files parameter. The default value is NO. |
Overwrite if exists | Yes/No | No | No | OVERWRITE="YES" | When selected, specifies that, if files already exist in the destination, they should be overwritten. The default value is NO. |
Only if exists in destination | Yes/No | No | No | ONLYIFEXIST="YES" | When selected, denotes 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. The default value is NO. Valid only if the Overwrite if exists parameter is selected. |
Match case | Yes/No | No | No | MATCHCASE="YES" | Indicates whether the properties set within this activity should be case sensitive in relation to the files to be renamed. The default value is NO. |
Session Properties
Property | Type | Required | Default | Markup | Description |
---|---|---|---|---|---|
Session | Text | Yes | FTPSession | SESSION="SessionName" | Specifies the session name (created in a previous FTP - Logon step) that this activity should originate from. This permits several FTP activities to be linked to a specific session, thus, allowing multiple simultaneous FTP transfers to take place within a single task. |
Custom Description
This action includes the Description tab for entering a custom step description.
More on setting custom step description
Standard Error Handling Options
This action also includes the standard Error Causes and On Error failure handling options/tabs.
More on Error Handling Options
Additional Notes
Variables and Expressions
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 pressingF2.
More on variables
More on expressions
More on the expression builder
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:
This sample task renames files by way of FTP.
<AMFTP ACTIVITY="rename" SOURCE="/home/myFolder/originalFileName.txt" DEST="/home/myFolder/newFileName.txt" OVERWRITE="YES" SESSION="FtpSession1" />