I have written a Windows scheduler that takes the backup of a folder in a particular location. The folder names are appended with the current time-stamp.
echo Starting Backup of File System
For /f "tokens=2-4 delims=/ " %%a in ('date /t') do (
set dt=%%c-%%a-%%b
)
For /f "tokens=1-4 delims=:." %%a in ('echo %time%') do (
set tm=%%a%%b%%c%%d
)
set bkupfoldername=UPLOADS_BACKUP_%1%dt%_%tm%
xcopy D:\Source > D:\Destination\%bkupfoldername% /Y /E /H /I
echo Backup has been completed.
I want to run another scheduler job, that should keep the latest 30 folders in the Destination folder and delete the rest.
I'm new to this. What do you think must be working?