so, you have a ton of files, accumulating, you want to clean them up/remove them once they hit a certain age, say 20 days old, Here is how to do that, very easy.
1. Create Windows Bat Files to Delete Files or Folders that are older than a certain age!
2. Save bat file to directory where you want to clean up files or sub folders
3. To automate, create a windows task that executes this bat file.
Delete Files
REM: Purge files
FORFILES /S /D -20 /C "cmd /c IF @isdir == FALSE del /F /Q @path"
Delete Folders
REM: Purge folders
FORFILES /S /D -30 /C "cmd /c IF @isdir == TRUE rd /S /Q @path"
No comments:
Post a Comment