simonc edited this page Dec 29, 2010 · 20 revisions

Filename format

Using the -f option, a filename format can be specified.
The -x option is an equivalent for the extension.

Use the --no-ext option to simply remove the extension.
To specify the number of dots in the extension (2 for .tar.gz) use the --dots N option.

Basic formatters

In the format, several characters have a special meaning.

'$' the original case
'&' uppercase
'%' lowercase
'*' camelcase

absrenamer -f"*" heLLo_WorlD.TxT
#=> Hello_World.TxT

absrenamer -x"%" heLLo_WorlD.TxT
#=> heLLo_WorlD.txt

absrenamer -f"*" -x"%" heLLo_WorlD.TxT
#=> Hello_World.txt

/!\ Be careful to use simple quotes when using the $ symbol /!\

absrenamer -f'$_Yeah' heLLo_WorlD.TxT
#=> heLLo_WorlD_Yeah.TxT

[…] Formatters and modifiers

Exept for the basic onces, any formatter is of the form [<modifier>...].
The modifier is one of the basics which is used to format the value of the formatter. Of course, it’s optional.

absrenamer -f'[1;5]' hello_word.txt
#=> hello.txt

absrenamer -f'[&1;5]' hello_word.txt
#=> HELLO.txt

Filename parts

It is possible to use only a part of the original filename or extension.

[2]   the second character of the original filename
[1;2] two characters starting at position 1 (first character) of the original filename
[1-2] characters from position 1 to position 2 of the original filename
[2-]  all characteres of the original filename starting at position 2

absrenamer -f"[2]" hello_world.txt
#=> e.txt

absrenamer -f"[2;4]" hello_world.txt
#=> ello.txt

absrenamer -f"[2-4]" hello_world.txt
#=> ell.txt

absrenamer -f"[4-]" hello_world.txt
#=> lo_world.txt

absrenamer -f"[1;4].[7-]" hello_world.txt
#=> hell.world.txt

Counters

Using #, counters can be added in the file name.
The amount of figures depends on the amount of # used.

absrenamer -f"photo_#" img123456.jpg img123465.jpg img123477.jpg img123478.jpg ...
#=> photo_1.jpg, photo_2.jpg, photo_3.jpg, ..., photo_10.jpg, ..., photo_100.jpg

absrenamer -f"photo_##" img123456.jpg img123465.jpg img123477.jpg img123478.jpg ...
#=> photo_01.jpg, photo_02.jpg, photo_03.jpg, ..., photo_10.jpg, ..., photo_100.jpg

A start number and a step can be specified with {start;step}.

absrenamer -f"photo_#{5}" img123456.jpg img123465.jpg img123477.jpg img123478.jpg ...
#=> photo_5.jpg, photo_6.jpg, photo_7.jpg, ..., photo_10.jpg, ..., photo_100.jpg

absrenamer -f"photo_##{5;2}" img123456.jpg img123465.jpg img123477.jpg img123478.jpg ...
#=> photo_05.jpg, photo_07.jpg, photo_09.jpg, photo_11.jpg, ..., photo_101.jpg

Testing before doing

The -l option will simulate the modifications and simply print them. No file will be modified.

Other options

Other informations

You can’t perform that action at this time.
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session.
Press h to open a hovercard with more details.