NUMBERING


SRename can add a number sequence to filenames or comments. This is done by using the TO or INSERT actions and giving them a decimal number of up to 9 digits enclosed in asterisks (*) as an argument.
If the given number contains any leading zeros these will be used on all the numbers that will be added.
The increment value can be changed from the default 1 by giving it immediately after the starting number prefixed by a plus or minus sign.
Extra padding characters can be given before and after the asterisk enclosed argument.
There are two main ways to apply numbering to filenames. You can supply a directory with or without a file pattern and the selected filenames will be numbered, or you can supply all the filenames that will be numbered in the command line. Recursion is not allowed with the second way.

When numbering is used with recursion, numbers will be placed in every matched filename in every directory that is entered. The number will be reset to the starting value for every directory.

Renumbering the filenames created by a numbering operation can't be done with the renumbering actions because those filenames won't share a common basename.
Instead the following rename operation which again uses numbering can do it:

MATCH /DEC/ DO 1 TO *<new starting number>*

It replaces the first decimal number in the filename with a new incremental number.


Examples:

> SRename <Path> INSERT *001* APPEND
"testpic" renamed as "testpic001"
"sample.iff" renamed as "sample.iff002"
"readme.txt" renamed as "readme.txt003"
"datafile" renamed as "datafile004"
"preview.png" renamed as "preview.png005"

Numbers are appended to the end of the filenames.


> SRename <Path> PREFIX ADD TO "file*20+2*"
"testpic" renamed as "file20.testpic"
"sample.iff" renamed as "file22.sample.iff"
"readme.txt" renamed as "file24.readme.txt"
"datafile" renamed as "file26.datafile"
"preview.png" renamed as "file28.preview.png"

Numbers are inserted at the prefix, and step value is set to 2.


> SRename "testpic" "sample.iff" "readme.txt" "datafile" "preview.png" INSERT {*50*} APPEND
"testpic" renamed as "testpic{50}"
"sample.iff" renamed as "sample.iff{51}"
"readme.txt" renamed as "readme.txt{52}"
"datafile" renamed as "datafile{53}"
"preview.png" renamed as "preview.png{54}"

Numbers are appended and enclosed in braces.


SRename #? MATCH /DEC/ TO *001*
"10picture.iff" renamed as "001picture.iff"
"11test.iff" renamed as "002test.iff"
"12pic.gif" renamed as "003pic.gif"
"13grab.png" renamed as "004grab.png"

Renumbers a filename sequence that doesn't share a common basename.


SRename #? MATCH /DEC/ TO *01+2*
"10picture.iff" renamed as "01picture.iff"
"11test.iff" renamed as "03test.iff"
"12pic.gif" renamed as "05pic.gif"
"13grab.png" renamed as "07grab.png"
 
As above but sets a step value of 2.