ap / rename

Rename multiple files
http://plasmasturm.org/code/rename/
Other
125 stars 11 forks source link

-N flag rejects patterns that don't start with 0 #10

Closed mattpr closed 4 years ago

mattpr commented 4 years ago

Macos Mojave, version 1.601, installed via homebrew.

$ rename -n -N 10 's/.*/V1D2E$N.mkv/' *.mkv
Error: unparseable counter format 10

vs

$ rename -n -N 010 's/.*/V1D2E$N.mkv/' *.mkv
'title_t00.mkv' would be renamed to 'V1D2E010.mkv'
'title_t01.mkv' would be renamed to 'V1D2E011.mkv'
'title_t02.mkv' would be renamed to 'V1D2E012.mkv'
'title_t03.mkv' would be renamed to 'V1D2E013.mkv'
'title_t04.mkv' would be renamed to 'V1D2E014.mkv'
'title_t05.mkv' would be renamed to 'V1D2E015.mkv'
'title_t06.mkv' would be renamed to 'V1D2E016.mkv'
'title_t07.mkv' would be renamed to 'V1D2E017.mkv'
'title_t08.mkv' would be renamed to 'V1D2E018.mkv'

Man page says:

$N A counter that increments for each file in the list. By default, counts up from 1.

The "-N" switch takes a template that specifies the padding and starting value of $N; see "Switches".

Expected behaviour:

Providing a parameter like 10 implies the starting value of $N should be 10 and there should be no zero padding.

ap commented 4 years ago

I agree. Thank you for the report.

Your examples can be simplified using -X btw.