FileSetAttribute

Sets a file access attribute

Method Signature

FileSetAttribute(file=[any], attribute=[string])

Arguments

Argument
Type
Required
Description
Default

file

any

true

The file path or File instance

attribute

string

true

The attribute to set true

Examples

Create a temporary file and then change read-only mode

Run Example

myFile = getTempFile( getTempDirectory(), "testFile" );
writeOutput( "is writable: " & getFileInfo( myFile ).CANWRITE );
fileSetAttribute( myFile, "readOnly" );
writeOutput( " → " & getFileInfo( myFile ).CANWRITE );

Result: is writable: YES → NO

Additional Examples

filesetattribute( "example.txt", "readonly" );

Last updated

Was this helpful?