I am looking for a way to delete all files older than 7 days in a batch file. I\'ve searched around the web, and found some examples with hundreds of lines of code, and oth
Run the following commands:
ROBOCOPY C:\source C:\destination /mov /minage:7
del C:\destination /q
Move all the files (using /mov, which moves files and then deletes them as opposed to /move which moves whole filetrees which are then deleted) via robocopy to another location, and then execute a delete command on that path and you're all good.
Also if you have a directory with lots of data in it you can use /mir
switch