File System - Touch

Declaration

<AMFILESYSTEM ACTIVITY="touch" SUBFOLDERS="yes/no" EXCLUDE="text" RE="yes/no" ISNEWERTHAN="date" MODE="text (options)" SOURCE="text" CREATIONTIME="date" LASTACCESSTIME="date" LASTWRITETIME="" TOUCH="date" READONLYFILE="text (options)" />

Related Topics    

Description

"Touches" one or more files in order to update their creation, last modified and/or last accessed date and time with the selected date/time. To specify more than one file, use wildcard characters (* or ?). To specify multiple file names or wildcard masks, separate them with a pipe symbol (Example: c:\*.txt|c:\*.bak).

Practical Usage

Often useful to categorize dates/times over a range of files. If your output is a whole tree of files, it can be quicker and more convenient to update the date/time of all files rather than it is to navigate through the whole tree looking at update times.

Parameters

General

Property

Type

Required

Default

Markup

Description

Mode

Text (options)

Yes

File

MODE="folder"

The type of item to perform this activity on. The available options are:

  • File (default) - This activity will be performed on a file.

  • Folder - This activity will be performed on a folder.

Source

Text

Yes

(Empty)

  1. FILE="C:\foldername\file.txt"

  2. FILE="C:\foldername\*.txt"

  3. FILE="C:\folder1\*.txt|C:\folder2\*.doc"

  4. FILE="file.txt"

The files that should be affected by the update. This can be a fully qualified path and file name (preferred) or a single file (requires use of the File System - Change folder activity). Wildcard characters (for example, * or ?) may be used to specify all files matching a certain mask. Multiple files and/or file masks can be specified by separating each entry with a pipe character (|) (for example, c:\temp\*.txt|c:\backup\*.bak). See File Masks & Wildcards for more details.

NOTE: Files with invalid paths are ignored at runtime.

Creation time

Text

No

Disabled

CREATIONTIME=

"%DateSerial(2009,01,01)

+TimeSerial(01,10,00)%"

If enabled, indicates the creation date/time that the specified files should be updated to. Click the Custom button to select from a list of pre-defined date/time ranges. Enable the Expression parameter to enter a date/time expression.

Last accessed time

Text

No

Disabled

LASTACCCESSTIME=

"%DateSerial(2009,01,01)

+TimeSerial(01,10,00)%"

If enabled, indicates the last accessed date/time that the specified files should be updated to. Click the Custom button to select from a list of pre-defined date/time ranges. Enable the Expression parameter to enter a date/time expression.

Last write time

Text

No

Disabled

LASTWRITETIME=

"%DateSerial(2009,01,01)

+TimeSerial(01,10,00)%"

If enabled, indicates the last write (or last modified) date/time that the specified files should be updated to. Click the Custom button to select from a list of pre-defined date/time ranges. Enable the Expression parameter to enter a date/time expression.

Touch

Text (options)

No

Only date

  1. TOUCH="dateandtime"

  2. TOUCH="date"

  3. TOUCH="time"

Determines what portion of the date/time value will be updated. The available options are:

  • Date and time (default) - Both the date and time potion will be updated.

  • Only date - Only the date portion will be updated.

  • Only time - Only the time portion will be updated.

If folder is read-only

Text

No

Disabled

READONLYFILE="touch"

Specifies the action that should be performed if the file's/folder's attribute is set to read-only. The available options are:

  • Skip - If a file is read-only, it will be skipped.

  • Error -The step will generate an error if a file is read-only.

  • Touch - The file will be touched regardless of whether it is read-only.

file Options

Property

Type

Required

Default

Markup

Description

Include subfolders

Yes/No

No

No

SUBFOLDERS="YES"

If selected, denotes that, if present, subfolders should be searched for files matching the mask specified in the File parameter. If disabled (default), subfolders are ignored.

Exclude mask

Text

No

(Empty)

ARCHIVETURNOFF="YES"

Causes this action to omit files matching the masks specified. File names or wildcard masks may be used. Multiple entries may be specified by separating them with a pipe symbol (Example: *.txt|*.bak).

Regular expression

Yes/No

No

No

RE="YES"

If selected, specifies that the value entered in the Exclude mask parameter will be interpreted as a regular expression. If disabled (default), the value will be interpreted as normal readable text.

Only if Newer Than

Date

No

Disabled

ISNEWERTHAN=

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

If enabled, causes this action to only act on files that are newer than the date/time specified. If this parameter is left blank or disabled (default), file dates are ignored.

Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.

Only if Older Than

Date

No

Disabled

ISOLDERTHAN=

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

If enabled, causes this action to only act on files that are older than the date/time specified. If this parameter is left blank or disabled (default), file dates are ignored.

Click the Custom button to select from a list of pre-defined date parameters. Enable the Expression option to allow entry of a date/time expression.

file filter

Property

Type

Required

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

Error Causes

On Error

Example

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

Touch files "C:\Temp\*.txt". Touch date only. Change creation time to "%DateAdd( "d", -30, CStr( Now() ))%". Change last access time to "%DateSerial(2010,06,01)+TimeSerial(12,06,22)%". Change last write time to "%DateSerial(2010,06,01)+TimeSerial(12,06,22)%". Skip read only files.

Copy
<AMFILESYSTEM ACTIVITY="touch" SOURCE="C:\Temp\*.txt" CREATIONTIME="%DateAdd(&quot;d&quot;, -30, CStr( Now() ))%" LASTACCESSTIME="%DateSerial(2019,12,09)+TimeSerial(11,53,47)%" LASTWRITETIME="%DateSerial(2019,12,09)+TimeSerial(11,53,47)%" />