本帖最后由 benton 于 2013-12-15 23:38 编辑
生成测试环境:- @echo off&SETLOCAL ENABLEDELAYEDEXPANSION
- set ccd=%cd%
-
- for /l %%a in (1,1,20) do (
- set /a n-=1
- set cn=0000%%a
- if !n! lss 5 (
- set /a n=!random:~-1!
- md %ccd%\2012-永久-!cn:~-3!_image
- cd /d %ccd%\2012-永久-!cn:~-3!_image
- for %%d in (%%a !random! !random!) do (
- set cm=0000%%d
- for /l %%b in (1,1,20) do (
- set /a m-=1
- if !m! lss 5 (
- set /a m=!random:~-1!
- if "00!random:~-1!" neq "00%%b" echo;>2012-永久-!cm:~-3!_page%%b_0.jpeg
- )
- )
- )
-
-
- )
-
- )
-
- cd /d %ccd%
复制代码 处理代码:- @echo off&SETLOCAL ENABLEDELAYEDEXPANSION
- set ccd=%cd%
-
- for /d %%a in (2012-永久*) do (
- for /f "delims=-_ tokens=1-4" %%1 in ("%%a") do (
- set sn=00%%3
- set strd=j027-%%1-%%2-!sn:~-4!
- pushd %%a
-
- echo;正在处理目录 "%%a" 到 "!strd!" ……
- for /f %%b in ('dir /b *.jpeg') do (
- set str=%%b
- for /f "delims=-_ tokens=1-4" %%1 in ("!str:page=!") do (
- set stre=000%%3
- set strf=000%%4
- ren "%%b" "j027-%%1-%%2-!stre:~-4!-!strf:~-4!.jpeg"
- )
- )
-
- popd
- move "%%a" "!strd!"
- )
-
- )
- echo;完成
- pause
复制代码
|