Created
February 25, 2014 14:43
-
-
Save derekmurawsky/9210118 to your computer and use it in GitHub Desktop.
A simple way to delete files older than X days in windows. This command is native and works as far back as server 2003.
This file contains hidden or 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
REM Deletes files in specified path older than X days. | |
forfiles -p "C:\path\to\files" -s -m *.* -d -360 -c "cmd /c del @path" | |
REM Alternate way to do it. Deletes all files in current directory older than X days. | |
forfiles -s -m *.* -d -360 -c "cmd /c del @path" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment