本帖最后由 pcl_test 于 2015-2-14 22:27 编辑
回复 5# SandraRusso
一、可重命名D:\W里的一级子文件夹里的图片- @echo off
- setlocal enabledelayedexpansion
- set "filesdir=D:\W\"
- for /f "delims=" %%i in ('dir /ad /b "%filesdir%"') do (
- pushd "%filesdir%%%i"
- set n=1
- for /f "delims=" %%a in ('dir /b *jpg 2^>nul ^|findstr /v ".-"') do (
- ren "%%a" "5-!n!.jpg"
- set /a n+=1
- )
- popd
- )
- pause
复制代码 二、可重命名D:\W里的N级子文件夹里的图片- @echo off
- setlocal enabledelayedexpansion
- set "filesdir=D:\W\"
- cd /d "%filesdir%"
- for /f "delims=" %%a in ('dir /a-d /s /b *jpg ^|findstr /v ".-"') do (
- >>"temp.txt" echo,%%~dpa
- )
- for /f "delims=" %%b in ('type "temp.txt"') do (
- if not defined %%b set %%b=Def & >>$ echo,%%b
- )
- move $ "temp.txt"
- for /f "delims=" %%c in ('type "temp.txt"') do (
- set n=1
- pushd "%%c"
- for /f "delims=" %%i in ('dir /b *jpg ^|findstr /v ".-"') do (
- ren "%%i" "5-!n!.jpg"
- set /a n+=1
- )
- popd
- )
- del temp.txt /f /q
- pause
复制代码
|