回复 23# miss_sokuber
这样试试,如果仍然不行,我放弃。- @echo off
- setlocal enabledelayedexpansion
- set /a x=0
- for %%i in (attack dead hit run stand) do (
- set "s=%%i" & set "s=!s:~0,1!"
- set "_!x!=%%i"
- set /a x+=1, #!s!=x
- )
- REM 查找png文件,其上一级目录名为a、d、h、r、s,上上一级目录名为数字0-4
- for /f "delims=" %%i in ('dir /b /a-d /s *.png ^| findstr /i "\\[0-4]\\[adhrs]\\[^\\]*$"') do (
- REM 当前png文件所在的目录
- set "curPath=%%~dpi"
- if /i "!prePath!" NEQ "!curPath!" (
- for %%j in ("%%i\..") do set /a n = !#%%~nj! * 1000
- REM png文件的上上一级目录
- for %%j in ("%%i\..\..") do (
- set "newFolder=!_%%~nj!"
- md "%%i\..\..\..\!newFolder!" 2>nul
- )
- ) else (
- set /a n+=1
- )
- REM 前一个png文件所在的目录
- set "prePath=%%~dpi"
- move "%%i" "%%i\..\..\..\!newFolder!\0!n!%%~xi"
- )
- REM 删除空目录
- for /f "delims=" %%i in ('dir /b /ad /s ^| sort /r') do rd "%%i" 2>nul
- pause
复制代码
|