使用渐进式枚举重命名文件 [英] rename file with progressive enumeration

查看:93
本文介绍了使用渐进式枚举重命名文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在文件夹VIDEO
中有一个名为mycat.avi的文件,因此路径为c:\video\mycat.avi

I have a file called mycat.avi inside a folder VIDEO so that the path is c:\video\mycat.avi

现在我想重命名,以便新的重命名从C0700.mxf

now I would like rename it so that the new re-name become start from C0700.mxf

如果文件夹c:\video中有另一个C0700.mxf, --->文件必须重命名为C0701.mxf

IF in folder c:\video is jet present another C0700.mxf -----> the file have to renamed C0701.mxf

如果在文件夹c中:\视频正在播放,则存在另一个C0701.mxf ----->文件必须重命名为C0702.mxf

if in folder c:\video is jet present another C0701.mxf -----> the file have to renamed C0702.mxf

如果在文件夹c:\video是jet当前另一个C0702.mxf ----->文件必须重命名为C0703.mxf

if in folder c:\video is jet present another C0702.mxf -----> the file have to renamed C0703.mxf

...等等

假设mycat.avi被重命名为C0716.mxf(所以现在在重命名操作后,显示为c:\video\C0716.mxf)

Supposing mycat.avi become renamed as C0716.mxf (so that now is present as c:\video\C0716.mxf)

->批处理必须创建.avs文件(位于c:\video文件夹),名为mycat_is_C0716.avs,其中包含:

--> 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)

FFVideoSource("c:\video\C0716.mxf")

最后,在c:\video
中仅存在文件:C0716.mxf和mycat_is_C0716.avs

So finally, in c:\video are present only this files: C0716.mxf and mycat_is_C0716.avs

谢谢

推荐答案

测试以下内容:

@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

这篇关于使用渐进式枚举重命名文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆