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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

How do I delete all files in a directory older than 2 weeks

Status
Not open for further replies.

rawii

IS-IT--Management
Oct 16, 2002
15
0
0
US
How do I delete all files in a directory older than 2 weeks.
We have a system that stores log files daily and I need to be able to delete files once they are more that a couple weeks old and leave the newer ones for reporting on. I have already written the code to do the reporting on the newer files but am not sure how to systematically go through all of the files and delete them based on their file date. I have already been pointed to the "FileTimeDate" function.
 
In VB4 you can use DIR([path\filename],x) to retrieve file names in a directory. (see help files on this)

Suggest you use this in conjunction with FileTimeDate.

--MiggyD
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top