Use cfdirectory to list the content of the directory. Then loop through the
contents and delete the files you don't want.
<cfdirectory action="list" directory = "mydirectorypath\"
name="dirlist">
<cfloop query="dirlist">
YOU COULD INSERT A TEST HERE TO SEE IF YOU NEED THE
FILE (E.G., It's referenced in a DB somewhere)
<cffile action="delete"
file="mydirectorypath\#dirlist.name#">
</cfloop>
Robert B. Harrison
Director of Interactive Services
Austin & Williams
125 Kennedy Drive, Suite 100
Hauppauge NY 11788
P : 631.231.6600 Ext. 119
F : 631.434.7022
http://www.austin-williams.com
Great advertising can't be either/or. It must be &.
Plug in to our blog: A&W Unplugged
http://www.austin-williams.com/unplugged
-----Original Message-----
From: Damo Drumm [mailto:[email protected]]
Sent: Monday, November 09, 2009 11:07 AM
To: cf-talk
Subject: Deleting contents within a folder
Hi
Im trying to delete all the contents within a folder using coldfusion, but
its deleting the actual folder each time
The contents of the folder contains be PDF's
has anyone any tips on deleting the contents and not the actual folder
Thanks
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:328131
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe:
http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4