I have a question
I have the rename command, but after I run the rename starting from 00, how to start from 01, please help me
this is the command that I use
for i in *.mkv; do
new=$(printf "Movie - %02d.mkv" "$a")
mv -i -- "$i" "$new"
let a=a+1
done
Simple as adding a variable (
a=1
) at the beginning:Here is in one line as you asked for:
The same can be done with bash's arithmetic evaluation, too. And it's generally preferred over
let
builtin.For exmaple,
On other hand, if you prefer a one-liner,
rename
command can do that: