There is a folder with logs. Logs split up over time on 100mb. You need old by date ( these are all logs after the 500th, if they exist ) separately pack the logs in zip (or rar) and move them to a separate folder.

With logs from 1st to 500th, no action is taken.

Task: You need to write a baht file to be added to the Windows Task Scheduler. Bat will be executed hourly.

    1 answer 1

    Based on the 7-Zip archiver . Task added to Windows Task Scheduler.

    for /f "skip=500 eol=: delims=" %%F in ('dir /b /od /ad c:\logs\*.log') do d:\arcivator\7za.exe a -sdel "d:\backup\%%~nF.7z" "c:\logs\%%F" 

    Archiving * .log files after the 500th (by date). Packed files are moved to a separate folder.