For the benefit of others the following is a summary of the code
snippets sent in from the various developers. Thanks to all that
responded.
Dave Adams
CFUG Ottawa
<cfexecute
name="c:\winnt\system32\cmd.exe"
parameters="/c del c:\trash\*.* /q" />
OR
<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>
OR
<cfset root="c:\inetpub\wwwroot\yourdirectory\">
<cfdirectory name="dGetDir" directory="#root#" action="List"> <cfloop
query="dGetDir">
<cfif type NEQ "DIR">
<cffile action="DELETE" file="#root##dGetDir.name#"
variable="content">
</cffile>
</cfloop>
OR
<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>
OR
< cfdirectory action="list" directory="mydirectory" name="dirlist">
< cfoutput query="dirlist">
< cffile action="delete" file="#name#">
< /cfoutput>
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
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
Signup for the Fusion Authority news alert and keep up with the latest news in
ColdFusion and related topics. http://www.fusionauthority.com/signup.cfm