Windows Batch file to move X number of files from folder to folder

前端 未结 3 1254
没有蜡笔的小新
没有蜡笔的小新 2021-01-14 15:48

I\'m trying to use a batch file to move files in blocks of 30 if there are less than 20 files in %DataLoc%. I modified code from a prior question. The problem

3条回答
  •  离开以前
    2021-01-14 16:38

    @echo off
    
    set Source=C:\perl\Drift_Bat\IN
    set Target=C:\perl\Drift_Bat\OUT
    
    set MaxLimit=20
    
    for /f "tokens=1* delims=[]" %%G in ('dir /A-D /B "%Source%\*.*" ^| find /v /n ""') do (
        move /y "%Source%\%%~nxH" "%Target%"
        if %%G==%MaxLimit% exit /b 0
    )
    

提交回复
热议问题