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
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,
You could use CFDirectory to get the listings of the directory, then
loop over that calling FileDelete() on the results...
2009/11/9 Damo Drumm damien.dr...@quinn-group.com:
Hi
Im trying to delete all the contents within a folder using coldfusion, but
its deleting the actual folder each
cfdirectory action=list
loop through the list
cffile delete based on list contents
On Mon, Nov 9, 2009 at 11:07 AM, Damo Drumm damien.dr...@quinn-group.comwrote:
Hi
Im trying to delete all the contents within a folder using coldfusion, but
its deleting the actual folder each time
The
Get a list of the files with cfdirectory action=list then loop over the
files.
Delete the files with cffile action=delete
-Original Message-
From: Damo Drumm [mailto:damien.dr...@quinn-group.com]
Sent: Monday, November 09, 2009 11:07 AM
To: cf-talk
Subject: Deleting contents within
, 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
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
cflib has a function for this.
http://cflib.org/udf/deleteDirectory
~|
Want to reach the ColdFusion community with something they want? Let them know
on the House of Fusion mailing lists
Archive:
8 matches
Mail list logo