rem @echo off rem оставить 2 cамых свежих каталогa set FOLDER=D:\Backup_Debian\7-zip D: cd %FOLDER% dir /O-D /AD /B > files.txt for /f "skip=2 delims=" %%G in (files.txt) do rmdir /q/s "%%G" set FOLDER=D:\Backup_Debian\VHDX D: cd %FOLDER% dir /O-D /AD /B > files.txt for /f "skip=2 delims=" %%G in (files.txt) do rmdir /q/s "%%G" timeout 30 exit /b 0