Score:1

how mass rename files with the following syntax

cc flag

I have about 130 images in the following syntax:

image100.jpeg
image101.jpeg
....
image1.jpeg
image20.jpeg
image21.jpeg
..
image2.jpeg

and so on. I want rename with the following syntax because I want conver them into pdf.

image001.jpeg
image002.jpeg
...
image020.jpeg
image021.jpeg
...
image100.jpeg

how could I do it in bash ?

bac0n avatar
cn flag
Does this answer your question? [Renaming hundreds of files at once for proper sorting](https://askubuntu.com/questions/473236/renaming-hundreds-of-files-at-once-for-proper-sorting)
Score:2
cn flag

You want to use rename for this.

rename 's/\d+/sprintf("%03d",$&)/e' image*
mangohost

Post an answer

Most people don’t grasp that asking a lot of questions unlocks learning and improves interpersonal bonding. In Alison’s studies, for example, though people could accurately recall how many questions had been asked in their conversations, they didn’t intuit the link between questions and liking. Across four studies, in which participants were engaged in conversations themselves or read transcripts of others’ conversations, people tended not to realize that question asking would influence—or had influenced—the level of amity between the conversationalists.