User Guide

104 Chapter 2: ColdFusion Tags
Usage
If you put ColdFusion applications on a server that is used by multiple customers, you must
consider the security of files and directories that could be uploaded or otherwise manipulated
with this tag by unauthorized users. For more information about securing ColdFusion tags, see
Configuring and Administering ColdFusion MX.
If
action = "list", cfdirectory returns the following result columns, which you can
reference in a
cfoutput tag:
name Directory entry name. The entries "." and ".." are not returned.
directory Directory containing the entry.
size Directory entry size.
type File type: File, for a file; Dir, for a directory.
dateLastModified The date that an entry was last modified.
attributes File attributes, if applicable.
mode Empty column; retained for backward compatibility with ColdFusion 5 applications
on UNIX.
You can use the following result columns in standard CFML expressions, preceding the result
column name with the query name:
#mydirectory.name#
#mydirectory.directory#
#mydirectory.size#
#mydirectory.type#
#mydirectory.dateLastModified#
#mydirectory.attributes#
#mydirectory.mode#
Note: If the
cfdirectory tag does not appear to work, for example, if a list operation returns an
empty result set, make sure that you have correct permissions to access the directory. For example, if
you run ColdFusion as a service on Windows, it operates by default as System, and cannot access
directories on a remote system or mapped drive; to resolve this issue, do not run ColdFusion using
the local system account.
The filter attribute specifies a pattern of one or more characters. All names that match that
pattern are included in the list. On Windows systems, pattern matching ignores text case, on
UNIX and Linux, pattern matches are case-sensitive.
The following two characters have special meaning in the pattern and are called metacharacters:
* matches any zero or more characters
? matches any single character