Batch rename sequential files by padding with zeroes

后端 未结 8 1182
天命终不由人
天命终不由人 2020-12-08 02:42

I have a bunch of files named like so:

output_1.png
output_2.png
...
output_10.png
...
output_120.png

What is the easiest way of renaming t

8条回答
  •  执笔经年
    2020-12-08 02:56

    I actually just needed to do this on OSX. Here's the scripts I created for it - single line!

    > for i in output_*.png;do mv $i `printf output_%04d.png $(echo $i | sed 's/[^0-9]*//g')`; done
    

提交回复
热议问题