Run Action Icon

Move File Action

Declaration

<AMFILEMOVE SOURCE="text" DEST="text" SUBFOLDERS="yes/no" OVERWRITE="yes/no" ISNEWER="yes/no" ONLYFOLDERSTRUCT="yes/no" OVERWRITEREADONLY="yes/no" OVERWRITEHIDDEN="yes/no" ONLYIFEXIST="yes/no" ISNEWERTHAN="date" ISOLDERTHAN="date" EXCLUDE="test" ATTRFILTER="text">

See Also

Copy File, Rename File, Delete File, Delete Folder, Rename Folder

Description

Moves files from the source path to the destination path. To specify more than one file use "wildcards" ( e.g. * or ? ). To specify multiple files or wildcard masks, separate them with a vertical bar. Example: c:\*.txt|c:\*.bak

Practical Usage

Usually used to move a single file, multiple files or complete directory structures to another location, drive or machine (on a local network).

Parameters

General Tab

Source
Text, Required
MARKUP:
a) SOURCE="c:\sourcefoldername\file.txt"
b) SOURCE="c:\sourcefoldername\*.txt"
c) SOURCE="C:\sourcefoldername\*.txt|C:\sourcefoldername\*.doc"
c) SOURCE="file.txt"

Specifies the file(s) to move. This can be a fully qualified path and filename (preferred) or a single file (requires use of the Change Folder action). Wildcards ( e.g. *.* or ? ) may be used to move files matching a certain mask. Multiple file and/or file masks may be specified by separating the entries with the | symbol.

Destination
Text, Required
MARKUP:
a) DEST="c:\sourcefoldername\file.txt"
b) DEST="c:\sourcefoldername\*.txt"
c) DEST="file.txt"

Specifies the destination folder and (optional) filename for the file(s) being moved. This can be a fully qualified path or a filename. Folders specified that do not exist will be automatically created at runtime.

Options Tab

Include subfolders
Yes/No, Optional default - NO
MARKUP: SUBFOLDERS="YES"

When set to YES, specifies that, if present, subfolders should be searched for files matching the mask specified in the "Source" [SOURCE] parameter

Preserve Folder Structure
Yes/No, Optional default - YES
MARKUP: KEEPFOLDERSTRUCT="NO"

Valid only if the "Include subfolder" [SUBFOLDERS] parameter is YES. When set to YES, specifies that subfolders found in the source folder should be created in the destination folder and source files should be moved into their respective folders rather than directly into the root of the target folder specified in "Destination" [DEST] parameter. If the "Include subfolders" [SUBFOLDERS] parameter is set to NO this parameter is ignored.

Overwrite if exist
Yes/No, Optional default - NO
MARKUP: OVERWRITE="YES"

When set to YES, specifies that, if files already exist they should be overwritten.

Only if newer
Yes/No, Optional default - NO
MARKUP: ISNEWERTHAN="YES"

Valid only if the "Overwrite if exist" [OVERWRITE] parameter is YES. When set to YES, specifies that only files that are newer than those in the destination folder(s) will be overwritten.

Only if exist in destination
Yes/No, Optional default - NO
MARKUP: EMPTYFOLDERS="YES"

Valid only if the "Include subfolder" [SUBFOLDERS] parameter is YES. When set to YES, specifies that 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.

Overwrite read only files
Yes/No, Optional default - NO
MARKUP: ONLYFOLDERSTRUCT="YES"

Valid only if the "Include subfolder" [SUBFOLDERS] parameter is YES. When set to YES, specifies that 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.

Overwrite hidden only files
Yes/No, Optional default - NO
MARKUP: ONLYFOLDERSTRUCT="YES"

Valid only if the "Include subfolder" [SUBFOLDERS] parameter is YES. When set to YES, specifies that already existing files should be overwritten even if the file in the source is marked with the "hidden" attribute. By default, hidden files are bypassed.

Exclude Mask
Text, Optional default - (blank)
MARKUP: EXCLUDE="*.txt"

Causes the action to not move files matching the mask(s) specified. Filenames or wildcard ( e.g. * or ? ) masks may be used, multiple entries may be specified by separating them with the | symbol (e.g. *.txt|*.bak)

Only if newer than
date, Optional default - (none)
MARKUP: ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only move file(s) if the source is newer than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding "Only if newer" [ISNEWER] parameter).

Only if older than
date, Optional default - (none)
MARKUP: ISOLDERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%"

Causes the action to only move file(s) if the source is older than the date/time specified. If parameter is left blank or not included, the date of the files will be ignored (excluding "Only if newer" [ISNEWER] parameter).

Attributes Tab

Attributes
Text, Optional (blank)
MARKUP:
ATTRFILTER="+R+A-S-H" (move Read Only and Archive files, not system or hidden)
ATTRFILTER="-S" (do not move "system" 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, build a single text item must be specified that contains the attributes of the files you wish to move.

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.

Notes

Standard Error Handling Options
This action also includes the standard "Error Causes" and "On Error" failure handling options/tabs

More on Error Handling Options

Variables and Expressions
All text fields allow the use of expressions by surrounding the expression in percentage signs (example: %MYVARIABLE%, %Left('Text',2)%). To help construct these expressions, a popup expression builder is available in all these fields by pressing F2.
More on variables...
More on expressions...
More on the expression builder...

Example

<AMFILEMOVE SOURCE="c:\folder1\*.*" DEST="c:\folder2\">

<AMFILEMOVE SOURCE="c:\folder1\*.*" DEST="c:\folder2\" SUBFOLDERS="YES" OVERWRITE="YES">

<AMFILEMOVE SOURCE="c:\folder1\originalname.txt" DEST="c:\folder2\newname.txt" SUBFOLDERS="YES" OVERWRITE="YES">

<AMFILEMOVE SOURCE="c:\folder1\*.*" DEST="c:\folder2\" SUBFOLDERS="YES" OVERWRITE="YES" ISNEWERTHAN="%DateSerial(2001,10,12) + TimeSerial(00,00,00)%">