User Guide
Performing Directory Operations 329
The text file is written to the location you specified. If the file already exists, it is
replaced.
You can use cffile action="Append" to append additional text to the end of an
existing text file, for example, when you create log files.
Performing Directory Operations
Use the cfdirectory tag to return file information from a specified directory and to
create, delete, and rename directories.
As with cffile, ColdFusion administrators can disable cfdirectory processing in
the ColdFusion Administrator Tags page. For details on the syntax of this tag, see the
CFML Reference.
Returning file information
When you use the action="list" attribute setting, cfdirectory returns five result
columns that you can reference in a
cfoutput tag:
• name Directory entry name.
•
size Directory entry size.
• type File type: F or D for File or Directory.
• dateLastModified Date an entry was last modified.
•
attributes File attributes, if applicable.
• mode (UNIX only) The octal value representing the permissions setting for the
specified directory.
To view directory information:
1 Create a new file in ColdFusion Studio.
2 Modify the file so that it appears as follows:
<html>
<head>
<title>List Directory Information</title>
</head>
<body>
<h2>List Directory Information</h2>
<cfdirectory
directory="c:\inetpub\wwwroot\mine"
name="mydirectory"
sort="size ASC, name DESC, datelastmodified">
<table cellspacing=1 cellpadding=10>
<tr>
<th>Name</th>
<th>Size</th>
<th>Type</th>