我有文件:
1.pgm ... 400.pgm 从 1 到 400 的连续数字,格式相同。
我想将它们复制到:
401.pgm ... 800.pgm,这基本上是因为我需要更多输入数据
我想知道在 Linux 中是否有快速的方法来做到这一点?
最佳答案
如果您的文件具有此结构,则只需:
for file in *.pgm ; do
num=${file%%.pgm}
newnum=$(( $num + 400 )) #more portable than 'let', thx to @user2719058 for the reminder!
echo mv "${file}" "${newnum}.pgm"
done
一旦你确信这能达到你想要的效果,就取出echo
...
关于linux - 在Linux中修改多个文件名的快速方法,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20383372/