I agree with Barney just deleting the directory and recreating it. 
Having to get a list of everything in the directory and then loop 
through that list and delete each item one-by-one seems "dirty" to me.

That being said, if you do want to go the list/loop/delete route, I 
would suggest using CF's java capabilities to do it. cfdirectory/cffile 
can kill a CF server if there are a lot of files or the files are large.

I once tried the cfdirectory/cffile approach on a directory that 
contained a large amount of images (about 2 gigs worth) and it croaked. 
  I changed it to use Java and it was able to do it.

This should help:
http://www.cfgears.com/index.cfm/2009/5/19/Tapping-in-to-ColdFusions-underlying-Java-capabilities
 



Thanks,

Eric Cobb
http://www.cfgears.com


Barney Boisvert wrote:
> If you don't mind synchronizing, you can just delete the directory (as
> you are now) and then recreate an empty one after you're done.
> Otherwise you'll need to use CFDIRECTORY to get a list of the
> contained files and delete them individually with CFFILE.
> 
> cheers,
> barneyb
> 
> On Monday, November 9, 2009, Damo Drumm <damien.dr...@quinn-group.com> wrote:
>> 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:328133
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to