Hello, I am looking for a "simple" batch file that will delete any folder in the root of the drive, older than "x" days - but not the subfolders.
My client insists on saving her data onto a large USB drive. I schedule a batch file to run similar to the one below:
robocopy /mir C:\Data "G:\%DATE%\data"
This runs each week and puts a copy of "data" into a folder under G:\ named after the date it runs.
i.e. "G:\Fri 04-24-2009\data"
In 12 weeks the drive is full. I need a script that will delete any folder - in the root - created more than 60 days ago (8 weeks). I do not want to delete sub folders older than 8 weeks due to most of the data in the sub folders are themselves older that 90 days. This allows the client to have 2 months worth of backups at one week increments.
Can this be done via the command line? What I am looking for is a line I can add to a batch file, or a Resource Tool Kit tool, that I could use for many clients. I know a VB Script would work, unfortunately my strength is with batch files not VB . If all you have is a VB script Id gratefully accept that too.