Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Delete Files By Date Range 1

Status
Not open for further replies.

Michael42

Programmer
Oct 8, 2001
1,454
US
Hello,

Can anyone offer an example of listing files in a directory that are older than 3 days?

I need to delete files that meet this criteria in a particular directory.

Thanks,

Michael42
 
there may be easier ways, but i would use CFDIRECTORY to return all the files, then just filter them in the CFOUTPUT

<CFDIRECTORY NAME="myfiles"
DIRECTORY="#ExpandPath('.')#"
SORT="DateLastModified DESC">

<CFOUTPUT QUERY="myfiles">
<CFIF DateDiff("d",DateLastModified,Now()) GT 3>
#myfiles.DateLastModified# #myfiles.Name#<br />
</CFIF>
</CFOUTPUT>

rudy | r937.com | Ask the Expert | Premium SQL Articles
SQL for Database-Driven Web Sites (next course starts May 8 2005)
 
r937,

Sorry to take so long to get back. Your example worked GREAT! :)

Thanks for taking the time to post,

Michael42
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top