File Cleanup Using Windows BAT/CMD Files

I have used thisbatch script to purge file base on their last modified date and provide a log of the files that were deleted. It’s really easy to read and know exactly what it is doing.

I recently recieved a VBS script that did about the same thing but was pages long.

The little script below is what I use now. I love how simple this is:

forfiles /P "E:\JDEdwards\E900\DDP\temp" /S /D -2 /C "cmd /c del @path && echo @path >> E:\TempCleanup_%date:~4,2%%date:~7,2%%date:~10,4%.log"

Got any quick simple tricks? Post them in the comments.

Leave a Reply