1

我想运行一个运行一个月的批处理脚本。代码如下。它处理大量视频并将其各种输出发送到各种文件夹。问题是如果它在无人看管的情况下运行一个月,磁盘可能已满。我希望它检查磁盘是否已满并继续写入另一个磁盘。有日志也不错

`@echo off
    setlocal enabledelayedexpansion
    set EXE_FILE=E:\opencv\build\bin\Release\blobtrack_sample.exe
    set INPUT_PATH=E:\Glasgow\Test\
    set TRACKS_PATH=E:\Glasgow\Tracks\
    set OUTPUT_PATH=E:\Glasgow\Result\
    set COUNT=0
    pushd %INPUT_PATH%
    for %%f in (*) do if %%f neq %~nx0 (
        set /a COUNT+=1
        echo Processing %%f, track=%%~nf.txt, btavi=test!COUNT!%%~xf
        %EXE_FILE% fg=FG_0S bd=BD_CC bt=CCMSPF btpp=None bta=Kalman btgen=RawTracks track=%TRACKS_PATH%\%%~nf.txt FGTrainFrames=125 btavi=%OUTPUT_PATH%\%%~nf.avi %%f
    )
    popd`
4

2 回答 2

0

考虑以下:

`@echo off
    set drive="E"
    set /A size=99
    FOR /F "tokens=1-5" %G IN ('dir ^| find "Dir(s)"') do set size=%I
    echo %size% > currentsize.txt
    echo %size% >> sizelog.log
    FOR /F "tokens=1-5" %G IN ('dir ^| find "currentsize.txt"') do set /A size=%J

REM SIZE LESS THAN 4 INDICATES LESS THAN 1024 Bytes left on the disk.
    IF %size% LSS 4 set drive="F"

    setlocal enabledelayedexpansion
    set EXE_FILE=%drive%:\opencv\build\bin\Release\blobtrack_sample.exe
    set INPUT_PATH=%drive%:\Glasgow\Test\
    set TRACKS_PATH=%drive%:\Glasgow\Tracks\
    set OUTPUT_PATH=%drive%:\Glasgow\Result\
    set COUNT=0
    pushd %INPUT_PATH%
    for %%f in (*) do if %%f neq %~nx0 (
        set /a COUNT+=1
        echo Processing %%f, track=%%~nf.txt, btavi=test!COUNT!%%~xf
        %EXE_FILE% fg=FG_0S bd=BD_CC bt=CCMSPF btpp=None bta=Kalman btgen=RawTracks track=%TRACKS_PATH%\%%~nf.txt FGTrainFrames=125 btavi=%OUTPUT_PATH%\%%~nf.avi %%f
    )
    popd`
于 2012-07-25T11:56:20.637 回答
0

我从这个答案中找到了这段代码。我建议您阅读那里的所有答案,您会发现可以使用的东西

将以下内容保存在批处理文件中并运行它。它将显示 C: 驱动器的空闲字节。在 IF 条件中使用变量来更改目标保存到驱动器

@setlocal enableextensions enabledelayedexpansion
@echo off
for /f "tokens=3" %%a in ('dir c:\') do (
    set bytesfree=%%a
)
set bytesfree=%bytesfree:,=%
echo %bytesfree%
endlocal && set bytesfree=%bytesfree%
于 2012-07-25T12:04:36.287 回答