I'm trying to get a list of directories using the <CFDIRECTORY tag but the return dataset is only displaying the files in the directory and not the sub-directories. The directory I'm attempting to query has 1 file and many sub-directories but the result only returns the single file. Does any one have any idea where I should look?

Here's the code - could there be some sort of Admin Setting that prevents the directory files from showing?

<CFDIRECTORY
	  DIRECTORY="#FolderToDisplay#"
	  NAME="DirectoryQuery"
	  SORT="Name ASC" 
	  ACTION="LIST"
	  LISTINFO="ALL" 
	  RECURSE="NO"
	  FILTER="*.*">
<CFOUTPUT>

<CFQUERY DBTYPE="query" NAME="FilesQuery">
	    SELECT Directory,Name,DATELASTMODIFIED,Size,Type FROM DirectoryQuery
	    ORDER BY Directory,Name,DateLastModified desc
</CFQUERY>

The problem is the "filter". Using *.* will filter out most directories because they don't have a "." in the name. Remove the filter and cfdirectory will return everything (files and subdirectories).

That did the trick - thanks a lot! I see this used to work in CF5 when they still returned the "." and ".." current and parent directory listings. We're using CF7 now. Thanks again

Oh ... yeah, I remember that. Thank goodness they got rid of the "." and ".."!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.