set "source=D:\1953\民事庭\2068\正卷"
set "extension=jpg"
set "pagesize=10"
set /a count=0
set /a folder=1
for %%F in ("%source%\*.%extension%") do (
set /a count+=1
if !count! equ %pagesize% (
set /a folder+=1
set /a count=0
)
set "destination=%source%\!folder!"
if not exist "!destination!" mkdir "!destination!"
move "%%F" "!destination!"
)
这个可以但是只能单个文件夹移动,不能批量,哪位大佬可以优化一下
set "source=D:\1953\民事庭"
set "extension=jpg"
set "pagesize=10"
for /l %%i in (2068, 1, 3099) do (
set "folder=!source!\%%i\正卷"
set /a count=0
set /a subfolder=1
for %%F in ("!folder!\*.%extension%") do (
set /a count+=1
if !count! equ %pagesize% (
set /a subfolder+=1
set /a count=0
)
set "destination=!folder!\!subfolder!"
if not exist "!destination!" mkdir "!destination!"
move "%%F" "!destination!"
)
)
这个代码解决了