Changes the attributes of one or more files or folders. Wildcards are supported.
FileSetAttrib, Attributes , FilePattern, OperateOnFolders?, Recurse?
The attributes to change. For example, +HA-R
.
To easily turn on, turn off or toggle attributes, prefix one or more of the following attribute letters with a plus sign (+), minus sign (-) or caret (^), respectively:
Note: Currently, the compression state of files cannot be changed with this command.
C:\Temp\*.tmp
. FilePattern is assumed to be in %A_WorkingDir% if an absolute path isn't specified.
If omitted, the current file of the innermost enclosing File-Loop will be used instead.
If blank or omitted, it defaults to 0 (only files are operated upon). Otherwise, specify one of the following digits:
Note: If FilePattern is a single folder rather than a wildcard pattern, it will always be operated upon regardless of this setting.
This parameter can be an expression.
If blank or omitted, it defaults to 0 (subfolders are not recursed into). Otherwise, specify one of the following digits:
This parameter can be an expression.
[v1.1.04+]: This command is able to throw an exception on failure. For more information, see Runtime Errors.
ErrorLevel is set to the number of files that failed to be changed or 0 otherwise.
If files were found, A_LastError is set to 0 (zero) or the result of the operating system's GetLastError() function immediately after the last failure. Otherwise A_LastError contains an error code that might indicate why no files were found.
FileGetAttrib, FileGetTime, FileSetTime, FileGetSize, FileGetVersion, File-loop
Turns on the "read-only" and "hidden" attributes of all files and directories (subdirectories are not recursed into).
FileSetAttrib, +RH, C:\MyFiles\*.*, 1 ; +RH is identical to +R+H