/build/static/layout/Breadcrumb_cap_w.png

How to delete all but the most recent files?

I have a program generating a report once every hour and the reports are saved to a shared folder. I have been trying to create a script that will only leave the ten most recent files, as of now I going at least once a day and delete the files manually. I've done some research, but have only found scripts that delete files after x amount of days or weeks, nothing for hours. Can anyone help me with this?


0 Comments   [ + ] Show comments

Answers (1)

Posted by: SMal.tmcc 10 years ago
Red Belt
0

you should be able to modify this by changing the "59" to 601 and then it will kill files older then 601 minutes.

http://halfloaded.com/blog/vbscript-delete-all-files-older-than-one-hour/


Comments:
  • Thanks. I'll give this a shot and let you know. - RingoHellcat 10 years ago

Don't be a Stranger!

Sign up today to participate, stay informed, earn points and establish a reputation for yourself!

Sign up! or login

View more:

Share

 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ