I've tried a bunch of examples of the rename command but I can't figure out the syntax to do what I want.
I have a bunch of files labeled something like
File_Ex_1.jpg
File_Ex_2.jpg
File_Ex_3.jpg
File_Ex_4.jpg
...
File_Ex_10.jpg
File_Ex_11.jpg
etc.
I want to change only some of them by inserting a 0
so that the file names have the same number of characters.
So I want File_Ex_1.jpg
to go to File_Ex_01.jpg
, File_Ex_2.jpg
to File_Ex_02.jpg
How do you do this with the rename command?
This rename
command was installed via home-brew on a Mac.
Output of rename -v
:
rename -v
Usage:
rename [switches|transforms] [files]
Switches:
-0/--null (when reading from STDIN)
-f/--force or -i/--interactive (proceed or prompt when overwriting)
Wide character in print at /System/Library/Perl/5.18/Pod/Text.pm line 286.
-g/--glob (expand "*" etc. in filenames, useful in Windows™ CMD.EXE)
-k/--backwards/--reverse-order
-l/--symlink or -L/--hardlink
-M/--use=*Module*
-n/--just-print/--dry-run
-N/--counter-format
-p/--mkpath/--make-dirs
--stdin/--no-stdin
-t/--sort-time
-T/--transcode=*encoding*
-v/--verbose
Transforms, applied sequentially:
-a/--append=*str*
-A/--prepend=*str*
-c/--lower-case
-C/--upper-case
-d/--delete=*str*
-D/--delete-all=*str*
-e/--expr=*code*
-P/--pipe=*cmd*
-s/--subst *from* *to*
-S/--subst-all *from* *to*
-x/--remove-extension
-X/--keep-extension
-z/--sanitize
--camelcase --urlesc --nows --rews --noctrl --nometa --trim (see manual)