如何使用终端批量重命名文件? [英] How can I batch rename files using the Terminal?
本文介绍了如何使用终端批量重命名文件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有一组文件,都是nnn.MP4.mov
.我怎样才能重命名它们,使其只是 nnn.mov
?
I have a set of files, all of them nnn.MP4.mov
. How could I rename them so that it is just nnn.mov
?
推荐答案
首先,使用以下内容进行试运行(实际上不会重命名任何文件):
First, do a dry run (will not actually rename any files) with the following:
for file in *.mov
do
echo mv "$file" "${file/MP4./}"
done
如果一切正常,请从第三行中删除 echo
以实际重命名文件.
If it all looks fine, remove the echo
from the third line to actually rename the files.
这篇关于如何使用终端批量重命名文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文