User Guide

Setting File and Directory Attributes 323
Setting File and Directory Attributes
In Windows, you specify file attributes using the cffile attributes attribute. In
UNIX, you specify file and directory permissions using the
cffile and cfdirectory
mode attribute.
Windows
In Windows, you can set the following file attributes:
ReadOnly
Temporary
Archive
Hidden
System
Normal
To specify several attributes, use a comma-separated list, such as
attributes="ReadOnly,Archive". If you do not use attributes, the files existing
attributes are maintained. If you specify any other attributes with Normal, the
additional attribute overrides the Normal setting.
Example: Setting file attributes
This example sets the archive bit for the uploaded file:
<cffile action="Copy"
source="c:\files\upload\keymemo.doc"
destination="c:\files\backup\"
attributes="Archive">
Note
Make sure you include the trailing slash (\) when you specify the destination
directory. Otherwise, ColdFusion treats the last element in the pathname as a
filename.
UNIX
In UNIX, you can set permissions on files and directories for owner, group, and
other. Values for the
mode attribute correspond to octal values for the UNIX chmod
command:
4 = read
2 = write
1 = execute