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

delete files older than 15 days 1

Status
Not open for further replies.

sodax

Programmer
Jun 26, 2003
87
GB
hello, I am looking for a batch in order to delete automatically files older than 15 days,.

I already google it, but I cant find an easy way to do it.

if you have a script thanks to share it.

i want to make a test on server about logs that takes me a lot of space after 15 days.

thanks for help.

 
Search this forum as the topic has already been covered.
 
I have shared such a script in one of my FAQs: faq955-6503

I hope you find this post helpful.

Regards,

Mark

Check out my scripting solutions at
Work SMARTER not HARDER. The Spider's Parlor's Admin Script Pack is a collection of Administrative scripts designed to make IT Administration easier! Save time, get more work done, get the Admin Script Pack.
 
Hello, I have used the following to delete files older then 28 days just replace with the correct paths and the number of days and you should be good to go.


Dim fso, f, f1, fc
Set fso = CreateObject("Scripting.FileSystemObject")
Set f = fso.GetFolder("E:\Folder")
Set fc = f.Files
For Each f1 in fc
If DateDiff("d", f1.DateLastModified, Now) > 28 Then f1.Delete
Next

Faygo Man!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top