Reputation: 1
I would like to display a computer's root directory using ColdFusion. By that I mean
Thanks in advance
Edit: First of all thanks to everybody that responded. I just give some more clarification about my question. I want display my computer's root directory. Suppose I have some documents to save in my PC. I don't know where I save that doc. In a CF page I want to display
I want to display the above directory names dynamically generated through Java or CF. I think now my question is clear to everybody. Thanks to all.
Upvotes: 0
Views: 421
Reputation: 317
Below code may help you
<cfdirectory action="list" directory="#ExpandPath('.')#" name="myFiles">
<cfform name="myform" action="" method="post">
<cftree name="dirBrowse">
<cftreeitem query="myFiles" value="name">
</cftree>
</cfform>
You can find detailed answer at below link:
http://www.tek-tips.com/viewthread.cfm?qid=691047
Upvotes: 1
Reputation: 112160
Use cfdirectory
.
For example:
<cfdirectory action="list" directory="C:/" name="DirectoryQuery" />
<cfdump var=#DirectoryQuery# />
That will dump a list of the directories and files in the server's C drive, and acts like a standard database query.
To get multiple directories into the same query variable, you can get two lists and a "Query of Queries" to merge them:
<cfdirectory action="list" directory="C:/" name="FirstDirQuery" />
<cfdirectory action="list" directory="D:/" name="SecondDirQuery" />
<cfquery name="DirectoryQuery" dbtype="Query">
SELECT * FROM FirstDirQuery
UNION
SELECT * FROM SecondDirQuery
</cfquery>
<cfdump var=#DirectoryQuery# />
Upvotes: 1