cfdirectory action=list directory=mydirectory name=dirlist
cfoutput query=dirlist
cffile action=delete file=#name#
/cfoutput
Ryan
-Original Message-
From: David Adams [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, December 03, 2002 3:22 PM
To: CF-Talk
Subject: Recursive File
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
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
That'll delete everything but sub-directories
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
David Adams wrote:
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.
Why loop?
cfexecute
name=c:\winnt\system32\cmd.exe
parameters=/c del c:\trash\*.* /q /
David Adams wrote:
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.
Why loop?
cfexecute
name=c:\winnt\system32\cmd.exe
parameters=/c del c:\trash\*.* /q /
Subject: Re: Recursive File Delete
David Adams wrote:
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.
Why loop?
cfexecute
name=c:\winnt\system32\cmd.exe
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
8 matches
Mail list logo