Handles interactions with directories.
|
Note In the ColdFusion Administrator, the security settings on the Tag Restrictions page under ColdFusion Basic Security may prevent |
If you write ColdFusion applications that run on a server used by multiple customers, you must consider the security of the files and directories that could be uploaded or otherwise manipulated by cfdirectory. For more information about securing ColdFusion tags, see Advanced ColdFusion Administration.
<cfdirectory action = "directory action" directory = "directory name" name = "query name" filter = "list filter" mode = "permission" sort = "sort specification" newDirectory = "new directory name">
When using the action = "list", cfdirectory returns five result columns you can reference in your cfoutput:
name Directory entry name.
size Size of directory entry.type File type: File for File or Dir for Directory. dateLastModified Date an entry was last modified.attributes File attributes, if applicable. mode (UNIX and Linux only) Octal value that specifies the permissions setting for the directory. For information about octal values, see the UNIX man pages for the chmod shell command. You can use the following result columns in standard CFML expressions, preceding the result column name with the query name:
#mydirectory.name#
#mydirectory.size# #mydirectory.type# #mydirectory.dateLastModified# #mydirectory.attributes# #mydirectory.mode#
<!---------------------------------------------------------------------
This example shows the use of cfdirectory to display
the contents of the snippets directory in CFDOCS.
---------------------------------------------------------------------->
<html>
<head>
<title>
cfdirectory Example
</title>
</head>
<body>
<H3>cfdirectory Example</H3>
<!--- use cfdirectory to give the contents of the
snippets directory, order by name and size
(you may need to modify this path) --->
<cfdirectory directory = "c:\inetpub\wwwroot\cfdocs\snippets"
name = "myDirectory"
sort = "name ASC, size DESC">
<!--- Output the contents of the cfdirectory as a cftable --->
<cftable query = "myDirectory">
<cfcol header = "name:"
text = "#Name#">
<cfcol header = "SIZE:"
text = "#Size#">
</cftable>
</body>
</html>