If you do mean recursive you might look at a custom tag of mine:

http://www.depressedpress.com/DepressedPress/Content/ColdFusion/CustomTa
gs/DP_FileFind/Index.cfm

It doesn't delete now, but it does do the recursion and collects files
(and filters them if you like).  It would be trivial to add a "delete"
in there.

Jim Davis

> -----Original Message-----
> From: S. Isaac Dealey [mailto:[EMAIL PROTECTED]] 
> Sent: Tuesday, December 03, 2002 4:48 PM
> To: CF-Talk
> Subject: Re: Recursive File Delete
> 
> 
> > I am looking for a simple block of code that will loop through a 
> > directory and delete it's files when called.  I do NOT want 
> to delete 
> > the directory, only its contents.
> 
> > Pseudo code:
> 
> > Set CurrentDirectory
> > For each file in directory
> >  Delete it
> > Next.
> 
> > I am sure this is easy for some of you and I would be interested to 
> > see who can do it the most eloquently.
> 
> > Thanks again CF-Talk
> 
> You don't really mean recursive do you? Recursive would mean 
> remove all files in all subdirectories as well... Assuming 
> you mean only what the pseudocode says, you're almos there already...
> 
> <cfset mypath = expandpath("my/directory/path") />
> <cfdirectory action="list" name="rsfile" directory="#mypath#" 
> /> <cfloop query="rsfile">
>       <cfif rsfile.type is "file">
>               <cffile action="delete" file="#mypath#/#rsfile.name#" />
>       </cfif>
> </cfloop>
> 
> 
> 
> s. isaac dealey                954-776-0046
> 
> new epoch                      http://www.turnkey.to
> 
> lead architect, tapestry cms   http://products.turnkey.to
> 
> certified advanced coldfusion 5 developer 
> http://www.macromedia.com/v1/handlers/index.cf> m?ID=21816
> 
> 
> 
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4
Subscription: 
http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Structure your ColdFusion code with Fusebox. Get the official book at 
http://www.fusionauthority.com/bkinfo.cfm

Reply via email to