本帖最后由 terse 于 2023-4-3 18:31 编辑
原来的代码理解错误。重写的是按文件名序号,移动到对应文件夹 不知结果是否符合- @echo off&setlocal enabledelayedexpansion
- for /f "delims=" %%i in ('dir /b /a-d *.mp3 *.m4v^|find /v /c ""') do set /a n=%%i
- set /an+=10000,d=500,b=d-1
- if %n% gtr 10000 (
- for /l %%i in (10000,!d!,!n!) do (
- set /a "start=%%i,end=start+b,start+=^!(start-10000)"
- if !end! geq !n! (
- set old=!start:~-4!-!n:~-4!(完)
- ) else set old=!start:~-4!-!end:~-4!
- set "_start=1!old:~,2!"
- set "_end=1!old:~5,2!"
- md "!old!" 2>nul
- for /l %%j in (!_start!,1,!_end!) do (
- set s=%%j
- move "!s:~1!*.mp3" "!old!" >nul 2>nul
- move "!s:~1!*.m4v" "!old!" >nul 2>nul
- )
- )
- )
复制代码
|