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.

Categories

File and Directory Access

Comments

comments powered by Disqus