Skip to main content
Inspiring
October 13, 2014
Answered

cfdirectory showing folders but not files CF11

  • October 13, 2014
  • 1 reply
  • 577 views

I'm using the cfdirectory example code right of Adobe's site yet in CF11 I can only get it to show the folders in the directory and not any of the files.  Is it possibly a security setting in CF11?

The code is pretty basic:

<cfdirectory directory="D:/IIS" name="dirQuery" action="LIST">

<!--- Get an array of directory names. --->

<cfset dirsArray=arraynew(1)>

<cfset i=1>

<cfloop query="dirQuery">

<cfif dirQuery.type IS "dir">

    <cfset dirsArray=dirQuery.name>

    <cfset i = i + 1>

</cfif>

</cfloop>

<cfdump var="#dirsArray#">

<br>

<!--- Get all directory information in a query of queries.--->

<cfquery dbtype="query" name="dirsOnly">

SELECT * FROM dirQuery

WHERE TYPE='Dir'

</cfquery>

<cfdump var="#dirsOnly#"

Thanks!

Gary

This topic has been closed for replies.
Correct answer BKBK

ColdFusion is behaving as expected. By specifying 'dir' as type, you tell it to only show folders. If you want it to show files, then specify the type as 'file'.

1 reply

BKBK
Community Expert
BKBKCommunity ExpertCorrect answer
Community Expert
October 14, 2014

ColdFusion is behaving as expected. By specifying 'dir' as type, you tell it to only show folders. If you want it to show files, then specify the type as 'file'.

ghanna1Author
Inspiring
October 14, 2014

Thanks!

BKBK
Community Expert
Community Expert
October 14, 2014

Cheers, Gary.