返回列表 发帖
回复 6# wqj


图片顺序不连续V1.bat
@echo off
cd /d "%~dp0"
setlocal enabledelayedexpansion
set "MaxNum=2"
for /l %%i in (1,1,10) do (
    md "%%i" 2>nul
    set "FileNum=0"
    for /l %%j in (1,1,100) do (
        if !FileNum! lss !MaxNum! (
            if exist "%%j.jpg" (
                move "%%j.jpg" "%%i\"
                set /a FileNum+=1
            ) else if exist "%%j.jpeg" (
                move "%%j.jpeg" "%%i\"
                set /a FileNum+=1
            ) else if exist "%%j.png" (
                move "%%j.png" "%%i\"
                set /a FileNum+=1
            ) else if exist "%%j.bmp" (
                move "%%j.bmp" "%%i\"
                set /a FileNum+=1
            )
        )
    )
)COPY
测试代码之前请做好备份

TOP

回复 6# wqj


图片顺序不连续V2.bat
@echo off
cd /d "%~dp0"
setlocal enabledelayedexpansion
set "MaxNum=2"
for /l %%i in (1,1,10) do (
    call :HandleFolder %%i
)
:HandleFolder
md "%1" 2>nul
set "FileNum=0"
for /l %%j in (1,1,100) do (
    if !FileNum! lss !MaxNum! (
        if exist "%%j.jpg" (
            move "%%j.jpg" "%1\"
            set /a FileNum+=1
        ) else if exist "%%j.jpeg" (
            move "%%j.jpeg" "%1\"
            set /a FileNum+=1
        ) else if exist "%%j.png" (
            move "%%j.png" "%1\"
            set /a FileNum+=1
        ) else if exist "%%j.bmp" (
            move "%%j.bmp" "%1\"
            set /a FileNum+=1
        )
    ) else (
        goto :eof
    )
)COPY
测试代码之前请做好备份

TOP

回复 10# wqj


图片顺序不连续V1.1.bat
@echo off
cd /d "%~dp0"
setlocal enabledelayedexpansion
set "MaxNum=2"
for /l %%i in (1,1,10) do (
    md "%%i" 2>nul
    set "FileNum=0"
    for /l %%j in (1,1,100) do (
        if !FileNum! lss !MaxNum! (
            if exist "新 (%%j).jpg" (
                move "新 (%%j).jpg" "%%i\"
                set /a FileNum+=1
            ) else if exist "新 (%%j).jpeg" (
                move "新 (%%j).jpeg" "%%i\"
                set /a FileNum+=1
            ) else if exist "新 (%%j).png" (
                move "新 (%%j).png" "%%i\"
                set /a FileNum+=1
            ) else if exist "新 (%%j).bmp" (
                move "新 (%%j).bmp" "%%i\"
                set /a FileNum+=1
            )
        )
    )
)COPY
测试代码之前请做好备份

TOP

回复 12# wqj


图片顺序不连续V1.2.bat
@echo off
cd /d "%~dp0"
setlocal enabledelayedexpansion
set "MaxNum=2"
for /l %%i in (1,1,10) do (
    md "新建 (%%i)" 2>nul
    set "FileNum=0"
    for /l %%j in (1,1,100) do (
        if !FileNum! lss !MaxNum! (
            if exist "%%j.jpg" (
                move "%%j.jpg" "新建 (%%i)\"
                set /a FileNum+=1
            ) else if exist "%%j.jpeg" (
                move "%%j.jpeg" "新建 (%%i)\"
                set /a FileNum+=1
            ) else if exist "%%j.png" (
                move "%%j.png" "新建 (%%i)\"
                set /a FileNum+=1
            ) else if exist "%%j.bmp" (
                move "%%j.bmp" "新建 (%%i)\"
                set /a FileNum+=1
            )
        )
    )
)COPY
测试代码之前请做好备份

TOP

回复 14# wqj


图片顺序不连续V1.3.bat
@echo off
cd /d "%~dp0"
setlocal enabledelayedexpansion
set "MaxNum=2"
for /l %%i in (10,-1,1) do (
    md "新建 (%%i)" 2>nul
    set "FileNum=0"
    for /l %%j in (1,1,100) do (
        if !FileNum! lss !MaxNum! (
            if exist "%%j.jpg" (
                move "%%j.jpg" "新建 (%%i)\"
                set /a FileNum+=1
            ) else if exist "%%j.jpeg" (
                move "%%j.jpeg" "新建 (%%i)\"
                set /a FileNum+=1
            ) else if exist "%%j.png" (
                move "%%j.png" "新建 (%%i)\"
                set /a FileNum+=1
            ) else if exist "%%j.bmp" (
                move "%%j.bmp" "新建 (%%i)\"
                set /a FileNum+=1
            )
        )
    )
)COPY
测试代码之前请做好备份

TOP

回复 18# wqj


    请按照2楼的步骤操作
测试代码之前请做好备份

TOP

回复 20# wqj


我写的代码不需要你重复的发出来。因为这对于我理解你的需求没有任何帮助。
我只需要知道需求是怎样。哪里的文件名换成这样?移动之前还是移动之后?
文字加截图描述清楚你的需求就够了。
具体步骤请看2楼。
测试代码之前请做好备份

TOP

回复 23# wqj
@echo off
cd /d "%~dp0"
setlocal enabledelayedexpansion
set "MaxNum=2"
for /l %%i in (1,1,10) do (
    md "%%i" 2>nul
    set "FileNum=0"
    for /l %%j in (10001,1,10999) do (
        set "FileSeq=%%j"
        set "FileSeq=!FileSeq:~-4!"
        if !FileNum! lss !MaxNum! (
            if exist "新!FileSeq!.jpg" (
                move "新!FileSeq!.jpg" "%%i\"
                set /a FileNum+=1
            ) else if exist "新!FileSeq!.jpeg" (
                move "新!FileSeq!.jpeg" "%%i\"
                set /a FileNum+=1
            ) else if exist "新!FileSeq!.png" (
                move "新!FileSeq!.png" "%%i\"
                set /a FileNum+=1
            ) else if exist "新!FileSeq!.bmp" (
                move "新!FileSeq!.bmp" "%%i\"
                set /a FileNum+=1
            )
        )
    )
)COPY
1

评分人数

测试代码之前请做好备份

TOP

回复 26# wqj


    哪个文件夹已经存在?那种情况下24楼的代码结果和你希望的结果有什么差异?
测试代码之前请做好备份

TOP

返回列表