- @echo off
- cd /d "%~dp0"
- set "srcdir=C:\1"
- set "dstdir=C:\mp4"
- for /r "%srcdir%" %%A in ("*") do (
- call :getnewname "%%A"
- )
- pause
- exit /b
-
- :getnewname
- set "newname=%~nx1"
- set n=0
- :loop
- set /a n+=1
- if exist "%dstdir%\%newname%" (
- set "newname=%~n1_%n%%~x1"
- goto loop
- )
- echo copy %1 --^> "%dstdir%\%newname%"
- copy %1 "%dstdir%\%newname%"
- exit /b
复制代码
|