1

1-将需要修改的文件拖到同一个文件夹

2-打开终端输入

for i in *.avi; do mv "$i" "${i%.avi}.mp4"; done

相对路径写法

for i in ../6-php/*.avi; do mv "$i" "${i%.avi}.mp4"; done

绝对路径写法

 for i in  /Users/xuxiansheng/Desktop/06.\ 基于PHP7+MVC博客系统设计/7-面向对象_1/*.avi; do mv "$i" "${i%.avi}.mp4"; done

修改前:

image.png

修改后:

image.png

.mp4前有.avi修改成.mp4写法:

(for i in *.avi.mp4; do mv "$i" "${i%.avi.mp4}.mp4"; done)

例子:我现在要把aaaaaaaaaaaaa.jpg重命名为aaaaaaaaaaaaa_MED.jpg

请使用如下命令:

for i in *.jpg; do mv "$i" "${i%.jpg}_MED.jpg"; done

同理aaaaaaaaaaaaa_MED.jpg重命名为aaaaaaaaaaaaa_LRG.jpg的方法:

for i in *.jpg; do mv "$i" "${i%_MED.jpg}_LRG.jpg"; done

例如

for i in *.wmv; do mv "$i" "${i%.wmv}.mp4"; done
for i in *.avi; do mv "$i" "${i%.avi}.mp4"; done

webxEJIr
95 声望0 粉丝

计算机网络爱好者