Its a common need that often doesn’t really get sorted out, cleaning up old data in a file system. For starters, nobody knows when things were created, and the last time they were accessed or modified, let alone know how to go about cleaning it up without a lot of manual labour. I’ve created the scripts below to sort this problem out, and have used it many times to keep things tidy, usually in a scheduled task after the initial auditing phase.
Running the scripts against a file system will create a log of what files/folders would be deleted given a set of criteria e.g. all folders not accessed in the last 2 months, all files not modified in the last 14 days. Using the /delete option will then go about deleting those files.
The link below includes two vbs files, OldFileCleanup.vbs, and OldFolderCleanup.vbs. OldFileCleanup will trawl though a file system and delete files older than a specified date, optionally cleaning up any empty folders as it goes. OldFolderCleanup will delete any sub folders of the specified directory that are older than a specified date.
For both scripts, run with the /? option, or simply double click for usage information e.g. OldFileCleanup.vbs /?