![]() ![]() ![]() |
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.
CFDIRECTORY Attributes | |
---|---|
Attribute |
Description |
ACTION |
Optional. Defines the action to be taken with directory(ies) specified in DIRECTORY. Valid entries are:
The default is List. |
DIRECTORY |
Required for all ACTIONs. The name of the directory you want the action to be performed against. |
NAME |
Required for ACTION="List". Ignored for all other actions. Name of output query for directory listing. |
FILTER |
Optional for ACTION="List". Ignored for all other actions. Filter to be applied to returned names, for example, "*.cfm" |
MODE |
Optional. Used only when ACTION="Create" to define the permissions for a directory in Solaris. Ignored in Windows. Valid entries correspond to the octal values (not symbolic) of the Unix chmod command. Permissions are assigned for owner, group, and other, respectively. For example:MODE=644 assigns the owner read/write permissions and group/ other read permission. MODE=666 Assigns read/write permissions for owner, group, and other. MODE=777 Assigns read, write, and execute permissions for all. |
SORT |
Optional for ACTION="List". Ignored for all other actions. List of query columns to sort directory listing by. Any combination of columns from query output can be specified in comma separated list. ASC or DESC can be specified as qualifiers for column names. For example, in a CFDIRECTORY tag returning where NAME="mydir", you can sort as follows: SORT="dirname ASC, filename2 DESC, size, datelastmodified" Where colname is the name of any |
NEWDIRECTORY |
Required for ACTION="Rename". Ignored for all other actions. The new name of the directory specified in the DIRECTORY attribute. |
When using the ACTION=LIST, CFDIRECTORY returns five result columns you can reference in your CFOUTPUT:
You can use query results columns in standard CFML expressions, preceding the column name with the name of the query:
<CFDIRECTORY DIRECTORY="c:\winnt\system32" NAME="mydirectory" SORT="size ASC, name DESC, datelastmodified"> <CFOUTPUT QUERY="mydirectory"> Name: #mydirectory.name# <BR> Size: #mydirectory.size# <BR> Type: #mydirectory.type# <BR> Date last modified: #mydirectory.datelastmodified# <BR> Attributes: #mydirectory.attributes#<BR> Mode: #mydirectory.mode#<BR> </CFOUTPUT>
![]() ![]() ![]() |
AllaireDoc@allaire.com
Copyright © 1998, Allaire Corporation. All rights reserved.