Mar 9, 2005 #1 Michael42 Programmer Joined Oct 8, 2001 Messages 1,454 Location 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
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
Mar 9, 2005 1 #2 r937 Technical User Joined Jun 30, 2002 Messages 8,847 Location CA 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) Upvote 0 Downvote
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)
Mar 15, 2005 Thread starter #3 Michael42 Programmer Joined Oct 8, 2001 Messages 1,454 Location US r937, Sorry to take so long to get back. Your example worked GREAT! Thanks for taking the time to post, Michael42 Upvote 0 Downvote
r937, Sorry to take so long to get back. Your example worked GREAT! Thanks for taking the time to post, Michael42