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)
Please log in to answer
Posted by:
SMal.tmcc
11 years ago
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 11 years ago