Notice: With the launch of Adobe Cookbooks, this site will no longer be accepting new entries or posting new content. Thanks to everyone who submitted content!

How can I get a list of files in a directory?

Use the <cfdirectory> tag. Don't forget to use the recurse="true" attribute if you want the list to include the contents of subdirectories.

<cfdirectory action="list"
directory="#getDirectoryFromPath(getTemplatePath())#"
name="currentDir">


<cfoutput query="currentDir">
#name#<br>
</cfoutput>


This question was written by Jeremy Petersen.
It was last updated on February 28, 2006 at 8:46:38 AM EST.

CFML Referenced

GetTemplatePath()
<cfdirectory>
<cfoutput>

Categories

File and Directory Access

Comments

There are no comments for this entry.