Function Reference

FileSetAttrib

Sets the attributes of one or more files.

FileSetAttrib ( "file pattern", "+-RASHNOT" [, recurse] )

 

Parameters

file pattern File(s) to change, e.g. C:\*.au3, C:\Dir
+-RASHNOT Attribute(s) to set/clear. e.g. "+A", "+RA-SH"
recurse [optional] If this is set to 1, then directories are recursed into. Default is 0 (no recursion).

 

Return Value

Success: Returns 1.
Failure: Returns 0 if encountered any errors.

 

Remarks

The file pattern cannot contain spaces!
The attributes that can be modified with the function are + or -:
"R" = READONLY
"A" = ARCHIVE
"S" = SYSTEM
"H" = HIDDEN
"N" = NORMAL
"O" = OFFLINE
"T" = TEMPORARY

(Note that you cannot set the compressed/directory attributes with this function.)

 

Related

FileGetAttrib, FileGetTime, FileSetTime

 

Example


;mark all .au3 files in current directory as read-only and system
FileSetAttrib("*.au3", "+RS")
If @error Then MsgBox(4096,"Error", "Problem setting attributes."

;make all .bmp files in C:\ and sub-directories writable and archived
FileSetAttrib("C:\*.bmp", "-R+A", 1)
If @error Then MsgBox(4096,"Error", "Problem setting attributes."