本帖最后由 Five66 于 2023-9-1 15:51 编辑
这次应该没搞错了吧,文件名最好不要有特殊字符,还有前缀长度必须统一- @echo off
- rem 前缀长度 如1.2.3.4-111-001.jpg 前缀为 1.2.3.4-111 长度11
- set hz=11
-
- for %%a in (*.jp*) do (
- set "aaa=%%a"
- setlocal enabledelayedexpansion
- set thehz=!aaa:~0,%hz%!
- if not exist "!thehz!" echo 创建文件夹:"!thehz!"&md "!thehz!"
- echo 移动文件:%%a&move "%%a" "!thehz!\" 1>nul
- endlocal
- echo.
- )
- echo done&pause&exit /b
复制代码
|