Hi, I have a script that automatically backs up mobile devices to a computer every night that is run by Task Scheduler.
Now, I need a script or batch file that can also be run via Task Scheduler that will automatically go through the backup directory and delete folders (and the contents within that folder) older than a specified age (probably 7 days old).
I am fairly new, and just need a script that I can have run automatically so that I don't keep getting a huge backlog of old backup folders.
Thank you!
-David
My date format is MM-DD-YY
Post a few lines of the output of this. :: ===== script starts here ===============
::
:: older.bat 2012-10-07 17:25:37.89
@echo off & setLocal enableDELAYedeXpansioNfor /f "tokens=* delims= " %%a in ('dir/b') do (
echo %%~Ta
)
goto :eof
::====== script ends here =================
====================================
Life is too important to be taken seriously.M2
forfiles /p c:\backups /d -7 /c "cmd /c if @isdir==TRUE rd /s /q @path"
Hey Mechanix2Go...here is the info from your script: 09/30/2012 12:10 PM
09/28/2012 11:47 AM
10/07/2012 08:42 AMRazor - thank you! I will give that a try
Razor - that did it!! Thank you!!!
Yes (14) | ![]() | |
No (14) | ![]() | |
I don't know (15) | ![]() |