Move File Action Icon

Move File

Declaration

<AMFILEMOVE SOURCE="text" DEST="text" SUBFOLDERS="YES/NO" OVERWRITE="YES/NO" ISNEWER="YE/NOS" OVERWRITEREADONLY="YES/NO" OVERWRITEHIDDEN="YES/NO" ONLYIFEXIST="YES/NO" ISOLDERTHAN="date" ARCHIVETURNOFF="YES/NO" EXCLUDE="text" ATTRFILTER="text" RESULTDATASET="text" />

See Also

Split File | Move File | Create Folder | Delete File | Delete Folder | Rename Folder | Remove Folder | Touch File | Set Attributes | Read from File | Write to File | Synchronize Folders | Concatenate Files

File System - Move

Declaration

<AMFILEMOVE SOURCE="text" DEST="text" SUBFOLDERS="YES/NO" OVERWRITE="YES/NO" ISNEWER="YE/NOS" OVERWRITEREADONLY="YES/NO" OVERWRITEHIDDEN="YES/NO" ONLYIFEXIST="YES/NO" ISOLDERTHAN="date" ARCHIVETURNOFF="YES/NO" EXCLUDE="text" ATTRFILTER="text" RESULTDATASET="text" />

See Also

Change Folder | Concatenate Files | Copy | Delete | Get Checksum | Rename | Split File | Touch | Write To File

Description

Moves one or more folders or files from the source path to the destination path. To specify more than one folder/file, use wildcard characters (* or ?). To specify multiple files or wildcard masks, separate them with a pipe symbol (c:\*.txt|c:\*.bak). If an attempt is made to move a folder or file inside a folder that does not exist, the target folder will be created during runtime. This activity can optionally rename and move a folder/file by simply specifying a new destination path and folder/file name. In addition, this activity allows folders/files to be overwritten in the destination folder if the source folder contains folders/files with the same name.

Practical Usage

Commonly used to move one or more folders/files or complete folder structures to another location, drive, or share on the network. Can also be used  to move files generated by other AutoMate activities and/or overwrite an existing copy of a destination file.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

File/Folder

Text (Options)

Yes

File

MODE="folder"

Indicates what this activity should be performed on. The available options are:

  • File (default) -  This activity should be performed on file(s). A file is the common storage unit in a computer. All programs and data are contained in a file, and the computer reads and writes files.

  • Folder - This activity should be performed on folder(s). A folder holds one or more files, although a folder can also be empty. Folders provide a method for organizing files similar to a manila file folder containing paper documents in a file cabinet.

Different parameters may become available depending on which option is selected.

Source

Text

Yes

(Empty)

  1. SOURCE="c:\sourcefolder\file.txt"

  2. SOURCE="c:\sourcefolder\*.txt"

  3. SOURCE="c:\folder\*.txt|c:\folder\*.bak"

  4. SOURCE="c:\foldername\subfoldername

Specifies the path of the folder(s) or file(s) to move. This can be a fully qualified path and folder/file name (preferred) or a single folder/file (requires use of the Change Folder action). Wildcard characters (* or ?) may be used to move folders/files matching a certain mask. Multiple files and file masks may be specified by separating the entries with a pipe symbol (c:\*.txt|c:\*.bak).

Destination

Text

Yes

(Empty)

  1. DEST="c:\destfolder\file.txt"

  2. DEST="c:\destfolder\*.txt

  3. DEST="c:\destfolder\*.*"

  4. DEST="c:\destfolder\

Indicates the destination folder and (optionally) file name in which to move the folder/file. This can be a fully qualified path or a folder/file name. If the target folder does not exist, it will be created during runtime.

Create and Populate Dataset with Result Information

Text

No

(Empty)

RESULTDATASET="DatasetName"

The name of a dataset to be created and populated with results of this operation. More information about the fields that this dataset creates are entered below under Notes.

 

File Options Properties

Property

Type

Req'd

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.

Preserve Folder Structure

Yes/No

No

Yes

KEEPFOLDERSTRUCT="NO"

If set to YES (default value), subfolders found in the source folder will be created in the destination folder and source files will be moved into their respective folders rather than directly into the root of the target folder specified in the Destination parameter. If set to NO, source files will be moved into the root of the target folder instead. This parameter is active only if the Include Subfolder parameter is set to YES.

Include Empty Subfolders

Yes/No

No

No

EMPTYFOLDERS="YES"

If set to YES, subfolders found in the source folder will be created in the destination folder even if they do not contain any files. If set to NO (default value), empty subfolders are ignored. This parameter is active only if the Include Subfolder parameter is set to YES.

Only Folder Structure

Yes/No

No

No

ONLYFOLDERSTRUCT="YES"

If set to YES, subfolders found in the source folder will be created in the destination folder but no files will be moved. Enabling this option causes all other file-specific parameters to be ignored. This parameter is set to NO by default and active only if the Include Subfolder parameter is set to YES.

Overwrite if Exist

Yes/No

No

No

OVERWRITE="YES"

If set to YES, matching destination files will be overwritten. This parameter is set to NO by default.

Only if Newer

Yes/No

No

No

ISNEWER="YES"

If set to YES, only source files that are newer than those that match in the destination folder will overwrite existing files. Set to NO by default. This parameter is active only if the Overwrite if Exist parameter is set to YES.

Only if Exist in Destination

Yes/No

No

No

ONLYIFEXIST="YES"

If set to YES, only files that already exist in the destination will be moved from the source. All other files, regardless of whether they match the mask or other parameter settings will be bypassed. This parameter is set to NO by default and is active only if the Overwrite if Exist parameter is set to YES.

Overwrite Read-Only Files

Yes/No

No

No

OVERWRITEREADONLY="YES"

If set to YES, already existing files should be overwritten even if the file in the destination is marked with the read-only attribute. By default, read-only files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is set to YES.

Overwrite Hidden Files

Yes/No

No

No

OVERWRITEHIDDEN="YES"

If set to YES, specifies that already existing files should be overwritten even if the file in the destination is marked with the hidden attribute. By default, hidden files are not overwritten. This parameter is active only if the Overwrite if Exist parameter is set to YES.

Turn Archive Attribute Off

Yes/No

No

No

ARCHIVETURNOFF="YES"

If set to YES, specifies that the archive attribute of the source files should be switched OFF. The Windows archive attribute is generally used to track whether a file has been backed-up. Turning the source file's archive attribute off indicates to many backup programs that the file has already been backed-up. This parameter is set to NO by default.

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. Multiple entries may be specified by separating them with a pipe symbol (|), for example: *.txt|*.bak

Only if Newer Than

Date

No

(Empty)

ISNEWERTHAN=

"%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only move 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 (excluding Only if newer parameter).

Only if Older Than

Date

No

(Empty)

ISOLDERTHAN=

"%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only move 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 (excluding Only if newer parameter).

↑ Top of Page

File Filters Properties

Attributes Properties

Property

Type

Req'd

Default

Markup

Description

Attributes

Text (Options)

No

(Empty)

ATTRFILTER="+R+A-H" (move read-only & archive files but not hidden files)

This group of settings causes the action to filter which files are moved 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 wish to copy.

Available Options:

  • R—Read-only: Specifying "+R" causes files with this attribute turned on to be included, "-R" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • A—Archive: Specifying "+A" causes files with this attribute turned on to be included, "-A" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • S—System: Specifying "+S" causes files with this attribute turned on to be included, "-S" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • H—Hidden: Specifying "+R" causes files with this attribute turned on to be included, "-H" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

  • C—Compression: Specifying "+C" causes files with this attribute turned on to be included, "-C" causes files with this attribute turned off to be included, not specifying the letter (default) causes this attribute to be ignored.

 

Description Properties

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

Error Causes Properties

The Error Causes tab allows you to select/omit specific errors that should cause a particular step to fail.

More on Error Causes properties

On Error Properties

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

Notes

Datasets

A dataset is a multiple column, multiple row container object. This activity creates and populates a dataset containing a specific set of fields. The table below describes these fields (assuming the dataset name assigned was theDataset).

Name

Type

Return Value

theDataset.Source

Text

The path and file name of the source folder/ file.

theDataset.Size

Number

The size of the folder/file (in kb).

theDataset.Destination

Text

The path and file name of the destination file.

theDataset.Result

True/False

Returns TRUE if result of activity is a success, otherwise, returns a FALSE.

theDataset.Message

Text

The textual information associated to the result.

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.

 

Sample 1 - Rename File action used to rename all files from one directory to the another. Matching files will be overwritten.

 

<AMFILERENAME SOURCE="c:\sourcefolder\*.*" DEST="c:\destfolder\*.*" SUBFOLDERS="YES" OVERWRITE="YES" />

 

 

Sample 2 - Rename File action used to rename a file and at the same time, move that file to a new directory. If the file exists in the destination directory, it will be overwritten.

 

<AMFILERENAME SOURCE="C:\FolderName\FileName1.doc" DEST="C:\FolderName\FileName2.doc" SUBFOLDERS="YES" />

 

↑ Top of Page