本帖最后由 523066680 于 2021-10-18 10:10 编辑
- @echo off
- setlocal enabledelayedexpansion
- set driver="E:"
- set folder="E:\plotfiles"
- set GB300=322122547200
- set mask=0000000000000000
- set limit=%mask%%GB300%
- set /a minutes=10, f_times=minutes*60/10
-
- :loop
- for /f "tokens=3" %%d in ('dir /-C %driver% ^|find "可用字节"') do (set free=%mask%%%d)
- rem echo %free:~-16%
- rem echo %limit:~-16%
- if %free:~-16% lss %limit:~-16% (
- echo !free:%mask%=! 小于
- echo !GB300!,将尝试删除一个 .plot 文件
- echo,
- call :remove_one %folder%
- ) else (
- echo !free:%mask%=! ^> !GB300!, 目前大于300GB
- )
-
- rem 每10秒打一个点作为进度显示
- echo 等待 %minutes% 分钟:
- for /l %%a in (1,1,%f_times%) do (ping /n 10 127.0.0.1>nul&set /p s=.<nul)
- echo,
- goto :loop
- exit /b
-
- :remove_one
- set flag=0
- for /f "tokens=*" %%a in ('dir /s /b %~1\*.plot') do (
- set flag=1
- echo 删除的文件:"%%a"
- echo,
- del /f /a "%%a"
- goto :eof
- )
-
- set /p s=没有找到plot文件,按任意键结束<nul
- if %flag%==0 (pause>nul&exit)
复制代码
|