Manage folder using cfdirectory

Monday, March 20 Leave a Comment

in coldfusion, managing folder is quite simple. just use tag cfdirectory. here i'm just want to share to you guys how coldfusion manipulate folder. correct me if i'm wrong..

to list content of directory:

< action="list" directory="c:\myfolder" name="qFolderContent" recurse="yes">
that function will query folder "myfolder" on drive C, then it will put the query result in variable "qFolderContent". that's it. you now can display all the content in "myfolder" including it sub folder content too!


to delete folder:
< action="delete" directory="c:\myfolder" recurse="yes">
this will delete all files and sub folder under the "myfolder" directory. as you can see, this is very useful.


to rename folder:
< action = "rename" directory = "c:\myfolder" newdirectory = "c:\myfolder18">
to create new folder:
< action="create" directory="c:\myfolder">

as you all can see, coldfusion is quite simple language to learn. good luck!


p/s: extra spaces before cfdirectory is just to display purpose only. in real coding, there's no extra spaces ;)

0 comments »