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

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

Signup for cfbreak to stay updated on the latest news from the ColdFusion / CFML community. One email, every friday.

Fork me on GitHub