fileSetAttribute

Sets the attributes of an on-disk file in Windows. This function does not work with in-memory files.

fileSetAttribute(filePath, attribute) → returns void

fileSetAttribute Argument Reference

filePath string
Required

Path to on-disk file

attribute string
Required

Attribute to enable/disable

readonly/hidden sets the given attribute to true and the other one to false
normal sets both to false
Values:
  • readOnly
  • hidden
  • normal

Examples sample code invoking the fileSetAttribute function

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

Expected Result: is writable: YES → NO


Fork me on GitHub