I have the following files in a single directory:
1-1 - different text for each file here.txt
1-2 - different text for each file here.txt
.
.
1-9 - different text for each file here.txt
1-10 - different text for each file here.txt
1-11 - different text for each file here.txt
1-12 - different text for each file here.txt
.
.
I want to rename the files all at once (using zmv running in zsh) to:
1-01 - different text for each file here.txt
1-02 - different text for each file here.txt
.
.
1-09 - different text for each file here.txt
1-10 - different text for each file here.txt
1-11 - different text for each file here.txt
1-12 - different text for each file here.txt
Here's what I tried: zmv '1-([0-9])(*)' '1-0$1$2'
This results in following file names:
1-01 - different text for each file here.txt
1-02 - different text for each file here.txt
.
.
1-09 - different text for each file here.txt
1-010 - different text for each file here.txt
1-011 - different text for each file here.txt
1-012 - different text for each file here.txt
.
.
So I thought I'd change the find pattern to zmv '1-([0-9]{1})(*)' '1-0$1$2' to match only files with a single digit after the hyphen, but this doesn't work
(I just get zmv:232: no matches found: 1-([0-9]{1})(*)).
What am I doing wrong? Is this even possible using zmv or should I use something like sed in a for loop or something like that?
PS: I wanted to tag this question with 'zmv' but it seems like this tag doesn't exist, yet and I don't have enough reputation to create it. Maybe someone with enough reputation could add this tag to the question.