How do I get a listing of just the files or child directories in a directory?
You can use the cfdirectory tag with the list option, and then there are
two ways to only display the directories. The first option is to use
<cfif> to filter on 'type':
<cfoutput query="dirResults">
<cfif dirResults.type eq "dir">#dirResults.name#<br /></cfif>
</cfoutput>
The second option is to do a query of queries to filter the results:
<cfquery name="dirFilter" dbtype="query">
select name from dirResults
where lower(type) = 'dir'
</cfquery>
<cfoutput query="dirFilter">
#name#<br />
</cfoutput>
This question was written by Jacob Munson.
It was last updated on September 8, 2006 at 12:45:51 PM EDT.
CFML Referenced
Categories
Comments
There are no comments for this entry.