<CFSET TargetDir = "c:\foo">
<CFDIRECTORY ACTION="LIST" DIRECTORY="#TargetDir#" NAME="TheFiles">
<CFLOOP QUERY="TheFiles">
        <CFIF (Type IS "File") AND (Name IS NOT ".") AND (Name IS NOT "..")>
                <CFFILE ACTION="DELETE" FILE="#TargetDir#\#Name#">
        </CFIF>
</CFLOOP>

Chris Lofback
Sr. Web Developer

TRX Integration
28051 US 19 N., Ste. C
Clearwater, FL  33761
www.trxi.com


> -----Original Message-----
> From: David Adams [mailto:[EMAIL PROTECTED]]
> Sent: Tuesday, December 03, 2002 4:22 PM
> To: CF-Talk
> Subject: 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
>  
> Dave Adams
> CFUG Ottawa
> 
> 
> 
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
This list and all House of Fusion resources hosted by CFHosting.com. The place for 
dependable ColdFusion Hosting.

Reply via email to