Set-FileAttribute

This command changes the file attributes for the specified file(s) and directory(s). The attributes "Read-only", "Archive", "System" and "Hidden" can be enabled or removed. The mode of operation as well as the usable syntax follow the DOS command ATTRIB, whereby the use of placeholders and variables is permitted.

If there are no files under the specification given in files, no error message appears during the execution of the package. The command also works with UNC names if they are supported by the network.


Settings:

  • Directory
    Directory in which the files are searched or for which the attributes are to be changed. The use of variables is possible.
  • Change directory attributes
    Enable this option if you want to change the attributes for the specified directory and, if specified, its subdirectories.
  • Change file attributes
    Enable this option if you want to change attributes for files in the specified directory and, if enabled, its subdirectories..
  • Include subdirectories
    If you want to change also the subdirectories of the directory specified under "Directory" for changing the directory or file attributes, activate this option.
  • Use 32-Bit mode on x64 computer
    If the script is executed on a 64-bit operating system, the counterpart for 32-bit applications SysWOW64 can be used automatically when referring to the SYSTEM32 directory.
  • Files
    If you have activated the "Change file attributes" option, enter the name or naming scheme of the files to be changed here. You can use wildcards and variables.
  • Set
    In this section you specify which attributes are to be set.
    • System
      Enable this option to set the system attribute (valid for files only).
    • Hidden
      Enable this option to set the hidden attribute.
    • Read only
      Enable this option to set the read only attribute.
    • Archive
      Enable this option to set the archive attribute.
  • Delete
    In this area you specify which attributes are to be deleted if they were set for the specified objects.
    • System
      Enable this option to delete the system attribute (valid for files only)..
    • Hidden
      Enable this option to delete the hidden attribute.
    • Read only
      Enable this option to delete the read only attribute.
    • Archive
      Enable this option to delete the archive attribute.


Example:

The following example sets the "Read Only" attribute and clears the "Archive" attribute for all files in the Packaging PowerBench directory.


Corresponds to DSM eScript command:

  • SetFileAttr


See also: