Set Attributes Action Icon

Set Attributes

 

Declaration

<AMSETATTRIBUTES SOURCE="text" SUBFOLDERS="yes/no" ISNEWERTHAN="date" ISOLDERTHAN="date" ATTRIBUTES="text (+/-RASH combination)" ATTRFILTER="text (+/-RASH combination)" EXCLUDE="text" RESULTDATASET="text" />

See Also

Calculate File Checksum | Change Folder | Concatenate Files | Copy File | Create Folder | Delete File | Get File(s) information | Join File | Move File | Read from File | Remove Folder | Rename File | Rename Folder

File System - Set Attributes

 

Declaration

<AMSETATTRIBUTES SOURCE="text" SUBFOLDERS="yes/no" ISNEWERTHAN="date" ISOLDERTHAN="date" ATTRIBUTES="text (+/-RASH combination)" ATTRFILTER="text (+/-RASH combination)" EXCLUDE="text" RESULTDATASET="text" />

See Also

Change Folder | Concatenate Files | Copy | Create Folder | Delete | Get Checksum | Join Files | Move | Read From File | Rename | Split File | Synchronize Folders | Touch | Write To File

Description

Sets the attributes of one or more files specified. To specify more than one file, use wildcards (Example: * or ?). To specify multiple files or wildcard masks, separate them with a vertical bar. (Example: c:\*.txt|c:\*.bak).

Practical Usage

Used to set the attributes of one or more files. More on RASH File Attributes can be found below under Notes.

Parameters

General Properties

Property

Type

Req'd

Default

Markup

Description

Source

Text

Yes

(Empty)

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

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

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

The files that should be affected by the attribute change. This can be a fully qualified path and file name (preferred) or a file name only (requires use of the Change Folder action). Wildcard characters (* or ?) may be used to specify files matching a certain mask. Multiple file and/or file masks may be specified by separating the entries with a pipe symbol (|).

Attributes

Options

Yes

(Empty)

  1. ATTRIBUTES="+A+H"(archive, hidden attrib on)

  2. ATTRIBUTES="-S-H"(system, hidden attrib off)

  3. ATTRIBUTES="-R-A+S+H"(read-only and archive attrib off, system & hidden attrib on)

The attribute combination that the files should be modified to. In Visual mode simply select from the drop-down lists. In AML mode, use the RASH attribute system as outlined below.

Create and Populate Dataset

Text

No

(Empty)

RESULTDATASET="DatasetName"

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

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.

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)%"

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

(Empty)

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.

Attributes Properties

Property

Type

Req'd

Default

Markup

Description

Attributes

Text (Options)

 

No

(Empty)

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

This group of settings causes the action to filter which files are copied 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 act on.

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

RASH File Attributes - Overview

File attributes can be specific characteristics or certain permissions set for a file. Every file on your hard disk has one or more attributes; usually, these attributes are turned on and off by system components or external applications. The Set Attributes action allows you to set the attributes if one or more files. Moreover, many file-related actions include attribute properties allowing a way to filter which files worked on based on the current attribute settings of the source file(s). Up to four attributes can be assigned to each file at any one time. They start with the letters R, A, S, H.

R - Read-Only - Files with this attribute cannot be overwritten or erased by standard programs or users.

A - Archive - A system or program uses this attribute to determine which files changed since they were last copied or backed up. Similarly, backup programs like Seagate Backup Exec, Microsoft Backup, etc. all use this attribute to handle what files need to be backed up.

S - System - A file with this attribute is usually one that is an integral part of your operating system. This attribute has a special meaning for DOS and Windows systems.

H - Hidden - A file having this attribute cannot be seen by a normal DOS directory search or cannot be seen if Windows Explorer or similar programs aren't specifically set up to see them.

In visual mode, a group of controls are provided to assist in setting attributes for a file.

The available options are:

In markup mode, a single text item must be specified that contains the attributes of the files you wish to modify.

To turn an attribute on/off, use the + and - sign (+ = Turn on attribute, - = Turn off attribute) For example:

To change several attributes in a single pass, simply put them together. For example:

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.

 

Example 1: Set Attributes for file(s) "c:\myfile.txt".  System on.  

 

<AMSETATTRIBUTES SOURCE="c:\myfile.txt" ATTRIBUTES="+s" />

 

 

Example 2: Set Attributes for file(s) "C:\SourceFolder\*.*".  Exclude the file mask(s) "*.pri".  Archive on.  Include sub folders.  Only if older than "2/26/2007 11:41:46 PM".  Only if system is not set.  Only if hidden is not set.  Create and populate dataset "SetAttrDataset" with query results.  

 

<AMSETATTRIBUTES SOURCE="C:\SourceFolder\*.*" SUBFOLDERS="YES" ISOLDERTHAN="%DateSerial(2007,02,26) + TimeSerial(23,41,46)%" ATTRIBUTES="+a" ATTRFILTER="-s-h" EXCLUDE="*.pri" RESULTDATASET="SetAttrDataset" />

 

↑ Top of Page