问题
I have a file called mycat.avi inside a folder VIDEO so that the path is c:\video\mycat.avi
now I would like rename it so that the new re-name become start from C0700.mxf
IF in folder c:\video is jet present another C0700.mxf -----> the file have to renamed C0701.mxf
if in folder c:\video is jet present another C0701.mxf -----> the file have to renamed C0702.mxf
if in folder c:\video is jet present another C0702.mxf -----> the file have to renamed C0703.mxf
... and so on
Supposing mycat.avi become renamed as C0716.mxf (so that now is present as c:\video\C0716.mxf)
--> after the renaming operation, tha batch have to create a .avs file (located alwais in the c:\video folder) that are called mycat_is_C0716.avs that contains:
FFVideoSource("c:\video\C0716.mxf")
So finally, in c:\video are present only this files: C0716.mxf and mycat_is_C0716.avs
Thanks
回答1:
Test this:
@echo off
cd /d "c:\video"
for /L %%a in (0700,1,9999) do (
if exist "mycat.avi" if not exist "C%%a.mxf" (
ren "mycat.avi" "C%%a.mxf"
>"mycat_is_C%%a.avs" echo FFVideoSource^("c:\video\C%%a.mxf"^)
)
)
pause
来源:https://stackoverflow.com/questions/26160804/rename-file-with-progressive-enumeration