I found an answer for zero-padding numerical filenames which works fine for renaming filenames as follows :
1.jpg > 00001.jpg
2.jpg > 00002.jpg
.
.
.
9.jpg > 00009.jpg
That uses the following command:
rename 's/\d+/sprintf("%05d", $&)/e' *.jpg
But my filenames aren't numeric. They are an alphanumeric sequence, like: a.jpg, b.jpg, c.jpg...... m.jpg
.
In a similar way to the original question, I want to rename these so they display in the correct sequence. How do I do this?
0a.jpg
?aaaaa.jpg
? Do you want to rename them to00001.jpg
..00009.jpg
? – terdon Sep 28 '15 at 13:53