Last active
August 29, 2015 14:00
-
-
Save maxpowa/bd97e49e2bf553b0e865 to your computer and use it in GitHub Desktop.
Super-duper-file-age-deletion-tool or SDFADT for short, deletes files recursively in the running directory if their properties indicate that they are older than the user-provided date, and they match the user-provided filter.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@ECHO OFF | |
ECHO Welcome to the super-duper-file-age-deletion-tool, written by Max Gurela! | |
ECHO Simply follow through the prompts and you'll be set! | |
ECHO. | |
SET /p fileFilter=Please enter a file filter (name.type): %=% | |
SET /p varDays=Enter maximum age of files (days): %=% | |
ECHO.>>log.txt | |
ECHO Starting new file deletion run! %date% - %time%>>log.txt | |
ECHO ---------------------------------------------------------------->>log.txt | |
ECHO. | |
ECHO Deleting files older than %varDays% days matching %fileFilter%... | |
forfiles /M %fileFilter% /S /D -%varDays% /C "cmd /c del /F /Q @path & echo @path">>log.txt 2>&1 | |
ECHO Files deleted! Log located at %cd%log.txt | |
PAUSE |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment