Highlighted

cfdirectory showing folders but not files CF11

Participant ,
Oct 13, 2014

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

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'.

Views

413

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

cfdirectory showing folders but not files CF11

Participant ,
Oct 13, 2014

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by BKBK | Adobe Community Professional

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'.

Views

414

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Oct 13, 2014 0
Adobe Community Professional ,
Oct 14, 2014

Copy link to clipboard

Copied

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'.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 14, 2014 0
Participant ,
Oct 14, 2014

Copy link to clipboard

Copied

Thanks!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 14, 2014 0
BKBK LATEST
Adobe Community Professional ,
Oct 14, 2014

Copy link to clipboard

Copied

Cheers, Gary.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 14, 2014 0