RENUMBERING


SRename can perform renumbering of filename sequences with numbers of up to 9 digits. Number places, step value and position can be set by the user.
Inverting the numbers in a sequence can also be performed.

The following instructions are used in renumbering:


Renumbering actions: (all can be given at once, order is not important)

RENUMBER
STEP
PLACES
INVERT
NUMBERPOS


Renumbering selectors:

BASENAME


Renumbering options:

UPTO
PRESERVECASE




Renumbering can also be performed on filename sequences that don't share a common basename, if for example they have been created by adding incremental numbers to them as previously described.
In such a case you don't use the renumbering actions described here but a numbering rename operation.

 

 



Actions:


RENUMBER (RN) <new starting number> :



Specifies the new starting number of a filename sequence. All matching filenames will be renumbered unless an ending number is specified with UPTO.

Examples:

> SRename "Data:picture001" RENUMBER 50
"picture001" renamed as "picture050"
"picture002" renamed as "picture051"
"picture003" renamed as "picture052"
"picture004" renamed as "picture053"
"picture005" renamed as "picture054"
   ....
Renumbers all filenames with a basename of "picture" and have a number at the end, to values starting with 50. The leading zeros will be preserved


> SRename "Data:picture001" RENUMBER 50 UPTO 4
"picture001" renamed as "picture050"
"picture002" renamed as "picture051"
"picture003" renamed as "picture052"
"picture004" renamed as "picture053"

As above but will renumber up to filename "picture004"


> SRename "Data:10.frame" RENUMBER 020
"10.frame" renamed as "020.frame"
"11.frame" renamed as "021.frame"
"12.frame" renamed as "022.frame"
"13.frame" renamed as "023.frame"
"14.frame" renamed as "024.frame"
   ....
Renumbers all filenames with a basename of ".frame" starting at 10, to values starting at 20 setting a 3-digit minimum.


Giving a new starting number with leading zeros has the same effect as using the PLACES action.




STEP (ST) <step value> :



Sets the increment value of the number sequence. Default is 1 and can also take negative values.

Examples:

> SRename "Data:picture001" RENUMBER 30 STEP 2
"picture001" renamed as "picture030"
"picture002" renamed as "picture032"
"picture003" renamed as "picture034"
"picture004" renamed as "picture036"
  ....
New nunbers start at 30 and increase by 2.


> SRename "Data:picture001" STEP 3
"picture004" renamed as "picture010"
"picture003" renamed as "picture007"
"picture002" renamed as "picture004"
"picture001" not changed
  ....
Keeps the original starting value but sets a step value of 3.




PLACES (PL) <places value> :


Sets the minimum number of digits that the new number sequence will have.

Examples:

> SRename "Data:picture001" RENUMBER 30 PLACES 4
"picture001" renamed as "picture0030"
"picture002" renamed as "picture0031"
"picture003" renamed as "picture0032"
"picture004" renamed as "picture0033"
  ....


> SRename "Data:picture001" PLACES 1
"picture001" renamed as "picture1"
"picture002" renamed as "picture2"
"picture003" renamed as "picture3"
"picture004" renamed as "picture4"
  ....


> SRename "Data:picture001" UPTO 3 PLACES 2
"picture001" renamed as "picture01"
"picture002" renamed as "picture02"
"picture003" renamed as "picture03"




INVERT (IV) :



Invert the numbers in a filename sequence. This is how inverting works:

 

Original filename   New filename
file.10 becomes file.14
file.11 becomes file.13
file.12 not changed file.12
file.13 becomes file.11
file.14 becomes file.10



Executing such a sequence of rename operations poses a problem: how can "file.10" become "file.14" when "file.14" already exists.
SRename works around this by renaming these files to temporary filenames until the clashing filenames have been renumbered.
An error occurs ("New number already exists" error) if the clashing filenames aren't going to be renamed because they are outside the range of files to be renumbered.

Examples:

> SRename "Data:file100" INVERT
"file100" renamed as "109.srtemp861A5BC"
"file101" renamed as "108.srtemp861A5BC"
"file102" renamed as "107.srtemp861A5BC"
"file103" renamed as "106.srtemp861A5BC"
"file104" renamed as "105.srtemp861A5BC"
"file105" renamed as "file104"
"file106" renamed as "file103"
"file107" renamed as "file102"
"file108" renamed as "file101"
"file109" renamed as "file100"
"109.srtemp861A5BC" renamed as "file109"
"108.srtemp861A5BC" renamed as "file108"
"107.srtemp861A5BC" renamed as "file107"
"106.srtemp861A5BC" renamed as "file106"
"105.srtemp861A5BC" renamed as "file105"


> SRename "Data:file100" RENUMBER 50 INVERT
"file100" renamed as "file59"
"file101" renamed as "file58"
"file102" renamed as "file57"
"file103" renamed as "file56"
"file104" renamed as "file55"
"file105" renamed as "file54"
"file106" renamed as "file53"
"file107" renamed as "file52"
"file108" renamed as "file51"
"file109" renamed as "file50"




NUMBERPOS (NP) <position value> :



Sets the position of the number within the basename. Positive position values means character position from the left and negative values means character position from the right.

Examples:

> SRename "frame100.iff" NUMBERPOS 1
"frame100.iff" renamed as "100frame.iff"
"frame101.iff" renamed as "101frame.iff"
"frame102.iff" renamed as "102frame.iff"
"frame103.iff" renamed as "103frame.iff"
  ....
Moves all numbers to the beginning of the basename.


> SRename "100frame.iff" NUMBEPOS -5
"100frame.iff" renamed as "frame100.iff"
"101frame.iff" renamed as "frame101.iff"
"102frame.iff" renamed as "frame102.iff"
"103frame.iff" renamed as "frame103.iff"
  ....
Numbers are moved to the 5th character from the end of the basename.




Selectors:



BASENAME (BN) :



Selects the basename of a filename sequence for modification. Every available action can be applied to the basename with the exception of CONV8+3 action which wouldn't be very useful if applied to a basename because the complete filenames would exceed 11 characters as the numbers would also be included.

The position of the number within the basename is calculated according to the characters that have been inserted to or deleted from it, unless the number position is set manually with the NUMBERPOS action.
If the basename components are reorganized with SWAP, RSHIFT or LSHIFT, then the number follows the component that contains it.
BASENAME need only be given once even if multiple rename operations are given.

Examples:

> SRename "file100" BASENAME TO "picture"
"file100" renamed as "picture100"
"file101" renamed as "picture101"
"file102" renamed as "picture102"
"file103" renamed as "picture103"
  ....
Replaces the existing basename with "picture" in every filename.


> SRename "file100" BASENAME DELETE
"file100" renamed as "100"
"file101" renamed as "101"
"file102" renamed as "102"
"file103" renamed as "103"
  ....
Deletes the basename.


> SRename "Frame001.iff" BASENAME SWAP
"Frame001.iff" renamed as "iff.Frame001"
"Frame002.iff" renamed as "iff.Frame002"
"Frame003.iff" renamed as "iff.Frame003"
"Frame004.iff" renamed as "iff.Frame004"
  ....
Swaps the basename components.


> SRename "Frame001.iff" BASENAME MAIN LOWER : MAIN RIGHT 1 UPPER
"Frame001.iff" renamed as "framE001.iff"
"Frame002.iff" renamed as "framE002.iff"
"Frame003.iff" renamed as "framE003.iff"
"Frame004.iff" renamed as "framE004.iff"
  ....
Makes the main component of the basename lowercase and then the rightmost character uppercase.


 



Options:




UPTO (UT) <number or filename> :



Specifies the ending filename to be renumbered. It will accept the number of the ending filename or the ending filename itself.
It doesn't matter if the filename given to UPTO contains a path or not.

Examples:

> SRename "Data:picture001" RENUMBER 50 UPTO 6

Renumbers from "picture001" up to "picture006".


> SRename "Data:frame100" UPTO "frame110" BASENAME TO "AnimFrame"

Changes the basename from "frame100" up to "frame110".




PRESERVECASE (PC) :



This option preserves each basename's casing. If PRESERVECASE is not given all basenames will be the same as the basename of the first filename in the sequence, which is the default behaviour.

Example:

> SRename "frame01" RENUMBER 20 PRESERVECASE
"frame01" renamed as "frame20"
"FRAME02" renamed as "FRAME21"
"frame03" renamed as "frame22"
"FRAME04" renamed as "FRAME23"
"frame05" renamed as "frame24"