ACTIONS
The action instructions modify the parts of the filename determinded by any given selectors.
TO
INSERT
DELETE
UPPER
LOWER
TOGGLECASE
Component actions:
These actions modify the entire filename or specific components (prefix, main or suffix).
The only selectors that some component actions support are PREFIX, MAIN, and SUFFIX. No other selectors are allowed.
SWAP
LSHIFT
RSHIFT
CONV8+3
UNIFY
Action options:
The following options can redirect the result of the modification to the
filename or the comment or to both.
TOFILENAME
TOCOMMENT
Separator options:
The following options determine how the prefix and suffix separators are handled
when a component is added or deleted.
AUTOPSEP
AUTOSSEP
NOAUTOPSEP
NOAUTOSSEP
TO <string> :
Replaces the selected characters with the given string. It can
also be used to move files to other directories in the same volume if a path is supplied.
With the use of special keywords withing the string argument it can also be used to add number sequences and to perform
conversions.
Examples:
> SRename "OldFileName" LEFT 3 TO "New"
"OldFileName" renamed as "NewFileName"
> SRename "TestFile" "NewDir/"
Moves "TestFile" to "NewDir".
> SRename "TestFile" "NewDir/NewName"
Moves "TestFile" to "NewDir"
and
renames it as "NewName".
> SRename "Pics/Raytraced" TOCD TO "Rendered"
The file will be renamed but will also
be moved to the current directory.
INSERT (NS) <string> :
Secondary arguments:
AT <value>
APPEND (AP)
EXIST (EX)
CASESENS (CS)
Inserts the given string anywhere in the selected characters. The position
of the characters can be set with the AT secondary argument. If the value
given with AT is negative then the position is measured from the end of the
selected characters.
If AT is not used the string is simply inserted at the beginning of the
selected characters.
If APPEND is used the string is placed at the end of the selected characters.
If EXIST is used the
string is inserted only if it doesn't already exist at the specified
position. This comparison is not case sensitive by default
but this can be changed with the CASESENS secondary argument.
The INSERT action can also be used for the numbering of filenames.
Examples:
> SRename "Letter.txt" INSERT "First"
"Letter.txt" renamed as "FirstLetter.txt"
> SRename "AnyFilename" INSERT "XYZ" AT 4
"AnyFilename" renamed as "AnyXYZFilename"
> SRename "Sound" INSERT "Sample" APPEND
"Sound" renamed as "SoundSample"
> SRename "old_letter.txt" INSERT "Old" EXIST
"old_letter.txt" not changed
> SRename "old_letter.txt" INSERT "Old" EXIST CASESENS
"old_letter.txt" renamed as "Oldold_letter.txt"
> SRename "pic_last.iff" INSERT "Last" AT -5 EXIST
"pic_last.iff" not changed
DELETE (DL) :
Deletes the selected characters.
Examples:
> SRename #? LEFT 3 DELETE
Deletes the first 3 characters from all filenames.
> SRename #? SUFFIX DELETE
Deletes the suffix from all filenames.
> SRename #? MATCH /:/$#@ DELETE
Deletes every "$", "#" and "@"
character from filenames.
UPPER (UP) :
Makes the selected characters uppercase.
Examples:
> SRename #? LEFT 1 UPPER
Makes uppercase the first character of every
filename.
> SRename #? SUFFIX UPPER
Makes uppercase only the suffix of every filename.
LOWER (LW) :
Makes the selected characters lowercase.
Example:
> SRename "TEXTFILE" LOWER
"TEXTFILE" renamed as "textfile"
TOGGLECASE (TG) :
Makes the selected characters lowercase if they are uppercase and uppercase if they are lowercase.
Example:
>SRename "StUpIdCaSiNg" TOGGLECASE
"StUpIdCaSiNg" renamed as "sTuPiDcAsInG"
Component actions
SWAP (SW) :
Swaps the selected filename components. If 2 of the PREFIX, MAIN, SUFFIX
selectors are given, then the parts specified by these selectors will be
swapped. Otherwise if none of the above selectors are given or all of them,
then just the 2 extreme components are swapped.
SWAP has an effect only on filenames with at least 2 components, like
prefix-main, main-suffix, or all (prefix-main-suffix).
Examples:
> SRename "picture.iff" SWAP
"picture.iff" renamed as "iff.picture"
> SRename "001.picture.iff" SWAP
"001.picture.iff" renamed as "iff.picture.001"
> SRename "001.picture.iff" PREFIX MAIN SWAP
"001.picture.iff" renamed as "picture.001.iff"
LSHIFT (LS) :
Shifts the filename components to the left, the leftmost becomes the
rightmost. Like SWAP it has an effect only on filenames with at least 2
components. This action operates on the whole filename so the component
selectors have no effect with it.
Example:
> SRename "001.picture.iff" LSHIFT
"001.picture.iff" renamed as "picture.iff.001"
RSHIFT (RS) :
Shifts the filename components to the right, the rightmost becomes the leftmost. It has an effect only on filenames with at least 2
components. Like LSHIFT it also operates on the whole filename so the component
selectors have no effect with it.
Example:
> SRename "001.picture.iff" RSHIFT
"001.picture.iff" renamed as "iff.001.picture"
CONV8+3 (8+3) :
Converts filenames to the MS DOS format of 8+3 characters. The filename will
be made uppercase, if it has a suffix this will be cut to 3 characters in
length, and if it has a prefix it will only be maintained if there is room left
from the main component.
It is possible when converting
whole directories that some filenames will fail to be converted because they may
get the same name with other files.
For example picture-1.iff and picture-2.iff will both receive the name:
PICTURE-.IFF
Examples:
> SRename "User.prefs" CONV8+3
"User.prefs" renamed as "USER.PRE"
> SRename "sound.sample.iff" CONV8+3
"sound.sample.iff" renamed as "S_SAMPLE.IFF"
UNIFY (UN) <PMS>:
Unifies the filename components specified by the P, M, or S characters that
must be given after it, P meaning prefix, M main and S suffix. These characters
can be given in any order.
Note that unifying the main part is a little different than unifying the prefix
or suffix. Unifying the prefix or suffix causes the separator between them and
the main part to be deleted, whereas unifying the main part will remove from it
any separator characters that it main contain.
Examples:
> SRename "picture.001" UNIFY PMS
"picture.001" renamed as "picture001"
> SRename "001.picture.iff" UNIFY P
"001.picture.iff" renamed as "001picture.iff"
> SRename "001.some.complex.name.iff" UNIFY M
"001.some.complex.name.iff" renamed as
"001.somecomplexname.iff"
Action options
TOFILENAME (TF) :
This option causes the modified or unmodified comment to be redirected to the filename. If the comment needs only to be copied to the filename and not redirected, then the TOCOMMENT
option must also be given.
If a filename's comment contains characters that denote a path then only
the filename part of the comment will go to the filename.
Examples:
(file comment is "16bit sound sample")
> SRename "sample.iff" COMMENT TOFILENAME
"sample.iff" renamed as "16bit sound sample"
> SRename "sample.iff" COMMENT UPPER TOFILENAME TOCOMMENT
Comment of "sample.iff" changed from "16bit sound sample"
to "16BIT SOUND SAMPLE"
"sample.iff" renamed as "16BIT SOUND SAMPLE"
> SRename "sample.iff" ( TOCOMMENT : COMMENT TOFILENAME )
Comment of "sample.iff" changed from "16bit sound sample" to "sample.iff"
"sample.iff" renamed as "16bit sound sample"
When modifying the comment and using TOFILENAME to send the
result to the filename, also giving TOCOMMENT has the effect that the modified
comment at that point will be saved and can continue to be modified
from that point by any actions that may follow.
If TOCOMMENT is not given in the above case then the modified comment is lost
after the redirection and the final comment result will depend exclusively on
the comment actions after the redirection.
Example:
(file comment is "somecomment")
> SRename "somefile" COMMENT LEFT 1 UPPER TOFILENAME TOCOMMENT : COMMENT RIGHT 1 UPPER
Comment of "somefile" changed from "somecomment" to "SomecommenT"
"somefile" renamed as "Somecomment"
In the example above because TOCOMMENT is also given with TOFILENAME the result of the first
action is not lost, and the comment gets the result of both actions (LEFT 1 UPPER, RIGHT 1
UPPER).
> SRename somefile COMMENT LEFT 1 UPPER TOFILENAME : COMMENT RIGHT 1 UPPER
Comment of "somefile" changed from "somecomment" to "somecommenT"
"somefile" renamed as "Somecomment"
Now because TOCOMMENT is not given the result of actions before "TOFILENAME" is lost
as far as the comment is concerned and the comment gets the result only of the
actions after "TOFILENAME".
TOCOMMENT (TC) :
This option causes the modified or unmodified filename to be redirected to the comment. If the filename needs only to be copied to the comment and not redirected, then the TOFILENAME
option must also be given.
When the ICONS option is used and both the filename and comment are modified then only icon filenames are modified, not icon comments. Files other than icons will get both their filename and comment modified
in such a case.
Examples:
> SRename "brush1.bsh" SUFFIX TO "iff" TOFILENAME TOCOMMENT
Comment of "brush1.bsh" changed from "" to
"brush1.iff"
"brush1.bsh" renamed as "brush1.iff"
> SRename "brush1.bsh" TOCOMMENT
Comment of "brush1.bsh" changed from "" to
"brush1.bsh"
> SRename a#? ICONS TOCOMMENT : UPPER
Comment of "Airport.jpg" changed from "" to "Airport.jpg"
"Airport.jpg" renamed as "AIRPORT.JPG"
"Airport.jpg.info" renamed as "AIRPORT.JPG.info"
Comment of "Avenger.jpg" changed from "" to "Avenger.jpg"
"Avenger.jpg" renamed as "AVENGER.JPG"
"Avenger.jpg.info" renamed as "AVENGER.JPG.info"
Comment of "Alpha jet.jpg" changed from "" to "Alpha jet.jpg"
"Alpha jet.jpg" renamed as "ALPHA JET.JPG"
"Alpha jet.jpg.info" renamed as "ALPHA JET.JPG.info"
Comment of "Albatros.jpg" changed from "" to "Albatros.jpg"
"Albatros.jpg" renamed as "ALBATROS.JPG"
"Albatros.jpg.info" renamed as "ALBATROS.JPG.info"
In the above example the unmodified filename goes to the comment and
then the filename is made uppercase. The TOFILENAME option doesn't have to be
given here for the filename to be modified, because the action that is given
after TOCOMMENT (UPPER) implies that the filename is modified and the result goes by
default to the filename.
As both the filenames and comments are modified, icon comment are not modified.
When modifying the filename and using TOCOMMENT to send the result
to the comment, also giving TOFILENAME has the effect that the modified filename
at that point will be saved to the filename and can continue to be modified from
that point by any actions that may follow.
If TOFILENAME is not given in the above case then the modified filename is lost
after the redirection and the final filename result will depend exclusively on
the filename actions after the redirection.
Example:
> SRename "somefile" LEFT 1 UPPER TOCOMMENT TOFILENAME : RIGHT 1 UPPER
Comment of "somefile" changed from "" to "Somefile"
"somefile" renamed as "SomefilE"
In this example because TOFILENAME is also given with TOCOMMENT the result of the
first operation is not lost, and the filename gets the result of both operations (LEFT 1
UPPER : RIGHT 1 UPPER).
> SRename "somefile" LEFT 1 UPPER TOCOMMENT : RIGHT 1 UPPER
Comment of "somefile" changed from "" to "Somefile"
"somefile" renamed as "somefilE"
Now because TOFILENAME is not given the result of operations before "TOCOMMENT" is
lost as far as the filename is concerned and the filename gets the result only
of the operations after "TOCOMMENT".
Separator options
AUTOPSEP (AUP) :
Activates automatic handling of the prefix separator, which is on by default.
This means that the prefix separator is added when a prefix is added and is
deleted when a prefix is deleted.
This option should be given to re-activate automatic prefix separator handling if
it has been deactivated by the counteractive NOAUTOPSEP option.
AUTOSSEP (AUS) :
Activates automatic handling of the suffix separator, which is on by default.
This means that the suffix separator is added when a suffix is added and is
deleted when a suffix is deleted.
This option should be given to re-activate automatic suffix separator handling
if it has been deactivated by the counteractive NOAUTOSSEP option.
NOAUTOPSEP (NAP) :
Deactivates automatic handling of the prefix separator. That way the prefix
separator isn't added when a prefix is added and isn't deleted when a prefix is
deleted.
NOAUTOSSEP (NAS) :
Deactivates automatic handling of the suffix separator. That way the suffix
separator isn't added when a suffix is added and isn't deleted when a suffix is
deleted.
When the above separator options are given they remain active for all
given actions unless they cancel each other or when switching from filename
modification to comment modification or vice versa.
Separator options should be given before the actions and selectors that are
relevant for.
Examples:
>
SRename "anyfile.suffix" NOAUTOSSEP SUFFIX DELETE
"anyfile.suffix" renamed as "anyfile."
With the above the suffix separator is maintained.
>
SRename "prefix.anyfile.suffix" NOAUTOSSEP SUFFIX DELETE : PREFIX DELETE
"prefix.anyfile.suffix" renamed as "anyfile."
In this example the suffix separator is maintained but the prefix separator is
not, because AUTOPSEP is on by default.
|