如何脚本使用Mac命令行多个文件重命名 [英] How to script the rename of multiple files using the Mac command line
本文介绍了如何脚本使用Mac命令行多个文件重命名的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我有有一堆截图的文件夹。文件名全部以屏幕
和巴纽
结束了,我要重命名的文件名全部为 1.png
, 2.png
等。在Mac的使用终端。
I have a folder which has a bunch of screenshots. The filenames all start with Screen
and end with .png
, I want to rename the entire filenames as 1.png
, 2.png
, etc.. using terminal in Mac.
推荐答案
您可以尝试
i=1; for f in Screen*.png; do mv "$f" "$i.png" ; i=$((i + 1)); done
或相同的脚本
#!/bin/bash
i=1
for f in Screen*.png
do
mv "$f" "$i.png"
i=$((i + 1))
done
这篇关于如何脚本使用Mac命令行多个文件重命名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文