FTP - Rename

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 file(s) specified on the FTP server. This activity supports mutli-file renaming. To specify more than one file, use wildcards (e.g., * or ? ). To specify multiple files or wildcard masks, separate them with a vertical bar (e.g., *.txt|*.bak).

IMPORTANT: All files must be located in the same folder and must be renamed in the same folder.

Practical Usage

Renames one or more files during an established FTP session.

Folder Parameters

Property

Type

Required

Default

Markup

Description

Remote File(s)

Text

Yes

(Empty)

  1. SOURCE="/foldername/originalfilename.txt"

  2. SOURCE="/foldername/*.txt"

  3. SOURCE="/folder/*.txt|/folder/*.doc"

  4. SOURCE="originalfilename.txt"

Indicates the file(s) to rename. This can be a fully qualified UNIX style path and filename (preferred) or a single file (requires use of the FTP Change Folder action). Wildcards (e.g., *.* 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 (e.g., /*.txt|/*.doc").

New Name

Text

Yes

(Empty)

  1. DEST="/foldername/newfilename.txt"

  2. DEST="/foldername/*.txt"

  3. DEST="/foldername/*.txt|/foldername/*.doc"

  4. DEST="newfilenamefile.txt"

Specifies the new file name(s) for the files specified in the Remote File(s) parameter.

File Options Parameters

Property

Type

Required

Default

Markup

Description

Include Subfolders

Yes/No

No

No

SUBFOLDERS="YES"

When set to YES, specifies that, if present, subfolders should be searched for files matching the mask specified in the Remote File(s) parameter. The default value is NO.

Overwrite if exists

Yes/No

No

No

OVERWRITE="YES"

When set to YES, 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 set to YES, 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 set to YES.

Match Case

Yes/No

No

No

MATCHCASE="YES"

Indicates whether the properties set within this activity should be case sensitive in relation to the FTP server.  The default value is NO.

Exclude Mask

Text

No

(Empty)

EXCLUDE="*.txt"

Causes this activity to omit any files matching the mask(s) specified. Filenames or wildcard masks (e.g., * or ?) may be used. Multiple entries may be specified by separating them with the"|" symbol (e.g., *.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.

Session Parameters

Property

Type

Required

Default

Markup

Description

Session

Text

Yes

FTPSession

SESSION="SessionName"

Specifies the session name (created in a previous FTP Log On 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.  

Description tab - A custom description can be provided on the Description tab to convey additional information or share special notes about a task step.

Error Causes tab - Specify how this step should behave upon the occurrence of an error. (Refer to Task Builder > Error Causes Tab for details.)

On Error tab - Specify what AWE should do if this step encounters an error as defined on the Error Causes tab. (Refer to Task Builder > On Error Tab for details.)

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.

Description: Rename a file(s) from "/home/myFolder/originalFileName.txt" to "/home/myFolder/newFileName.txt" via FTP. Overwrite existing file(s). Session "FTPSession".

<AMFTP ACTIVITY="rename" SOURCE="/home/myFolder/originalFileName.txt" 
DEST="/home/myFolder/newFileName.txt" OVERWRITE="YES" />