Hey everyone. I have been developing a tools for my website to be able to view
code for files and edit it, copy files, rename, delete and so on. However
actually finding the file I want to edit it becomming rather bothersome seeing
as I have to know the exact name, and type it into my edit box. What I would
like to do is create a almost, windows explorer type of thing, where the
folders are listed, then you can click on the folder and it lists all the
folders and files inside of it. I don't need any fancy icons or anything, just
something like....
Root
-Source Files
*index.cfm
*Application.cfm
-Flash stuff
*flash stuff.swf
-IMG
-Profile pics
-Site pics
that kind of thing. Where the folders can just be clicked to be explored, and
it would be nice if they tabbed in as they went, but thats not totally
required. Any ideas?
zoeski80 - 30 Sep 2005 01:01 GMT
Hi Kenji
You can do a CFDIRECTORY to read all the directories and files within a
specified directory. You can differenciate between Files and Directories by the
TYPE returned by CFDIRECTORY you could then try to get files ending in eg.
listLast(Name, '.swf', '.') if you need to split the files up further.
Then each directory can be a link to the same cfm page which will then load up
the contents of the new directory. The link will need to pass through the
previous directory structure with the new directory appended so the CFDIRECTORY
has the full path specified.
The files could be links to open the actual file or to a page where it can be
edited/renamed/copied/deleted etc.
See attached code.
HTH
Zoe
<!--- NB CODE NOT TESTED --->
<!--- get directories and files at the selected level --->
<CFDIRECTORY
ACTION="List"
DIRECTORY="c:\inetpub\wwwroot\">
<!--- get directories from the list --->
<CFQUERY NAME="getDirectories" DBTYPE="QUERY">
SELECT Name
FROM myDirectory
WHERE Type = 'Dir'
</CFQUERY>
<!--- get files from the list --->
<CFQUERY NAME="getFiles" DBTYPE="QUERY">
SELECT Name
FROM myDirectory
WHERE Type = 'File'
</CFQUERY>