# 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. See the CFML Language Reference for details on the syntax of this tag.

## Returning file information

When using the ACTION=LIST, CFDIRECTORY returns five result columns you can reference in your CFOUTPUT:

- 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 -- (Solaris only) The octal value representing the permissions setting for the specified directory. For information about octal values, refer to the man pages for the chmod shell command.

| To view directory information:

1. Create a new file in 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>
       <TR>
           <TH>Name</TH>
           <TH>Size</TH>
           <TH>Type</TH>
           <TH>Modified</TH>
           <TH>Attributes</TH>
           <TH>Mode</TH>
       </TR>
       <CFOUTPUT QUERY="mydirectory">
       <TR>
           <TD>#mydirectory.name#</TD>
           <TD>#mydirectory.size#</TD>
           <TD>#mydirectory.type#</TD>
           <TD>#mydirectory.datelastmodified#</TD>
           <TD>#mydirectory.attributes#</TD>
           <TD>#mydirectory.mode#</TD>
       </TR>
       </CFOUTPUT>
       </TABLE>

       </BODY>
       </HTML>

3. Modify the line DIRECTORY="c:\inetpub\wwwroot\mine"so that it points to a directory on your server.
4. Save the file as `directoryinfo.cfm` and view it in your browser.