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" />

See Also

FTP Advanced, FTP Change Folder, FTP Create Folder, FTP Delete, FTP Download, FTP Log Off, FTP Log On, FTP Remove Folder, FTP Upload

Description

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

NOTE: 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.

Parameters

Folder Properties

Property
Type
Required
Default
Markup
Description

Remote File(s)

Text

Yes

(Empty)

a)SOURCE="/foldername/originalfilename.txt"
b)SOURCE="/foldername/*.txt"
c)SOURCE="/folder/*.txt|/folder/*.doc"
d)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 (i.e. *.* 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 (i.e. /*.txt|/*.doc").

New Name

Text

Yes

(Empty)

a)DEST="/foldername/newfilename.txt"
b)DEST="/foldername/*.txt"
c)DEST="/foldername/*.txt|/foldername/*.doc"
d)DEST="newfilenamefile.txt"

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

File Options Properties

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 (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.

Session Properties

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.  

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 pressing F2.

More on variables
More on expressions

More on the expression builder

Example

NOTE: The code below can be copied and pasted directly into the Steps pane 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" />

 

↑ Top of Page