@setlocal enableextensions enabledelayedexpansion
@echo off
goto detect
:del_files
echo "Hard Disk Space is less than 1TB , Now delete temp files..."
Rem Customize your forfiles scripts body
Rem For example , under E:\backupdir directory , delete files older than 55 days
forfiles.exe -p "E:\backupdir" -s -m file_name_* -D -55 -c "cmd /c del @FILE"
goto end
:detect
for /f "tokens=3" %%a in ('dir E:\') do (
set bytesfree=%%a
)
set bytesfree=%bytesfree:,=%
echo The bytes free is : %bytesfree%
endlocal && set bytesfree=%bytesfree%
if %bytesfree% GTR 1099511627776 echo "Hard Disk Space is greater than 1TB ~! "
if %bytesfree% GTR 1099511627776 goto del_files
goto end
:end
echo good bye
@echo off
goto detect
:del_files
echo "Hard Disk Space is less than 1TB , Now delete temp files..."
Rem Customize your forfiles scripts body
Rem For example , under E:\backupdir directory , delete files older than 55 days
forfiles.exe -p "E:\backupdir" -s -m file_name_* -D -55 -c "cmd /c del @FILE"
goto end
:detect
for /f "tokens=3" %%a in ('dir E:\') do (
set bytesfree=%%a
)
set bytesfree=%bytesfree:,=%
echo The bytes free is : %bytesfree%
endlocal && set bytesfree=%bytesfree%
if %bytesfree% GTR 1099511627776 echo "Hard Disk Space is greater than 1TB ~! "
if %bytesfree% GTR 1099511627776 goto del_files
goto end
:end
echo good bye
沒有留言:
張貼留言