Rename

The Rename internal command can be used to:

 

Command Arguments:

Argument

Type

Possible values

Description

(no argument)

-

-

Displays the Rename dialog. The rename operation will be performed on all selected files and folders. The dialog will open in the last mode it was used in (either simple or advanced).

Example: Rename

ADVANCED

/S

(no value)

Displays the Rename dialog in advanced mode.

Example: Rename ADVANCED

When combined with rename patterns or preset names, the ADVANCED argument can be used to ensure the command opens the Rename dialog instead of immediately renaming all selected items.

Example: Rename ADVANCED PATTERN=* TO=*.bak
Example: Rename ADVANCED PRESET="Number Files"

AUTORENAME

/S

(no value)

Automatically adds an incrementing number to the end of new filenames if they clash with existing files.

Example: Rename PATTERN "The *" TO * AUTORENAME

BY

/K/N

<increment>

Specifies the increment when renaming files with automatic numbering (using the NUMBER option). If not specified the default increment is 1.

Example: Rename NUMBER BY 2

CASE

/K

upper

Converts filenames to all-upper case.

Example: Rename CASE=upper

 

 

lower

Converts filenames to all-lower case.

Example: Rename CASE=lower NUMBER

 

 

firstword

Capitalizes the first letter of the filename.

Example: Rename CASE=firstword

 

 

allwords

Capitalizes the first letter of each word of the filename.

Example: Rename CASE=allwords

 

 

extupper

Converts the filename extension to upper case.

Example: Rename CASE=extupper

 

 

extlower

Converts the filename extension to lower case.

Example: Rename CASE=extlower

FILEINFO

/S

(no value)

Enables file information fields when renaming files. This lets you use file metadata (like MP3 artist tags, for example) to form the new names of files.

Example: Rename PATTERN * TO "{mp3track|#2} - {mp3title}.{ext}" FILEINFO

FINDREP

/O

(no value)

Enable find-and-replace mode. The PATTERN argument must be used to provide the string to find, and the TO argument provides the string to replace it with.

Example: Rename FINDREP PATTERN jones REPLACE smith

 

 

ext

Makes find-and-replace operate in the filename extension as well as in the stem of the filename.

Example: Rename FINDREP=ext PATTERN jpg REPLACE jpeg

FROM

 

<filename> ...

Renames the files specified on the command line, rather than those selected in the source file display. This argument can accept filenames or wildcard patterns. Remember to enclose each filename in quotes if it contains spaces.

Example: Rename FROM C:\Spool\*.tmp TO *.temp

INLINE

/O

(no value)

Activates inline renaming on the item in the source file display that currently has focus.

Example: Rename INLINE

 

 

all

Automatically selects the entire filename for editing.

Example: Rename INLINE=all

 

 

name

Automatically selects the filename's stem (but not the extension). Selects the whole name for a folder.

Example: Rename INLINE=name

 

 

endstem

Positions the cursor at the end of the filename's stem (before the extension), but does not automatically select any part of the name.

Example: Rename INLINE=endstem

 

 

ext

Automatically selects the filename's extension. Selects the whole name for a folder.

Example: Rename INLINE=ext

 

 

home

Positions the cursor at the beginning of the filename.

Example: Rename INLINE=home

 

 

end

Positions the cursor at the end of the filename.

Example: Rename INLINE=end

 

 

single

If more than one item is selected, the Rename dialog will be displayed. Without this, inline rename will begin on the focused item only.

Example: Rename INLINE=name,single

MATCHCASE

/S

(no value)

Makes the rename operation case-sensitive. Patterns and search strings must match the exact case of the filename.

Example: Rename PATTERN *.jpG TO *.JPG MATCHCASE

NOMATCHNOFAIL

/S

(no value)

Files which do not match the rename pattern are not 'failed'. This can be useful with multi-line functions which need to do some optional renaming before passing all of the files to additional commands.

By default, when NOMATCHNOFAIL is not used, if a file does not match the rename pattern then it will be flagged as a failure and skipped by the rest of the function (unless the very next command is another Rename, in which case the file gets a second chance).

If NOMATCHNOFAIL is used then files which do not match the rename pattern are still passed to subequent commands.

Example: Rename PATTERN "* Backup.*" TO *.* NOMATCHNOFAIL

NUMBER

/O

(no value)

Automatically number files. Selected files will be numbered in the order they are presented in the file display, so you should make sure the list is sorted as desired before using this command. The number 1 will be assigned to the first selected file, and the number for each subsequent file will be incremented by the value given for the BY argument (or by 1 if BY is not provided).

By default the number is added to the end of the filename, in front of the extension. You can specify a different location for the number by providing the [#] marker in the new filename.

Example: Rename PATTERN * TO [#]* NUMBER

 

 

<start>

Number files starting with the specified number. Providing a value for NUMBER also lets you zero-pad the assigned number. For example, the value 0010 means to start numbering at 10, and zero-pad to four digits. The [#] marker can also be used to specify zero-padding - [#5] would zero-pad to five digits.

Example: Rename NUMBER 00001 BY 2

PATTERN

/K

<pattern>

Specifies a wildcard pattern that represents the old (original) filename. This argument is used when performing a wildcard rename. The Rename command supports a simple wildcard syntax where one or more asterisks supplied for the PATTERN argument can be used to copy parts of the original name to the new name. The PATTERN argument is also used in conjunction with REGEXP to provide the search pattern for a regular expression rename, and in conjunction with FINDREP to provide the search string for a find-and-replace rename.

See the section on Renaming Files for a full discussion of the various renaming modes.

Example: Rename PATTERN IMGP(.*).jpg TO "Image \1.jpg" REGEXP

Specifying the FROM argument as well will mean the command ignores the current file selection and applies the specified rename on all matching files. Only files matching both the TO and PATTERN arguments would be renamed.

Example: Rename FROM *.jpg PATTERN IMGP(.*).jpg TO "Image \1.jpg" REGEXP

If the PATTERN and TO arguments are both given, the command will normally apply the rename immediately, without prompting for any further interaction; you can add the ADVANCED argument to instead display the Rename dialog, with the specified pattern, so that you can preview the operation and make adjustments, or cancel it entirely, as needed.

Example: Rename ADVANCED PATTERN * TO *.bak

PRESET

/K

regexp

Opens the Rename dialog in Regular Expression mode.

Example: Rename PRESET=regexp

 

 

findrep

Opens the Rename dialog in Find and Replace mode.

Example: Rename PRESET=findrep

 

 

last

Takes the settings from the last time the Rename dialog was used and applies them to the currently selected files, without opening the Rename dialog again. Similar to opening the dialog, selecting Last Rename from the list of presets and clicking OK.

Example: Rename PRESET=last

You can add the ADVANCED argument to make the dialog open and allow you to make changes, or cancel the operation entirely, before the rename is applied.

Example: Rename ADVANCED PRESET=last

 

 

!list

Displays a generated list of saved rename presets (acts as a dynamic button). Selecting a preset from the list will apply that rename operation to the currently selected files and folders.

Example: Rename PRESET=!list

 

 

<preset>

Applies the named saved rename preset to all currently selected files and folders. Rename presets are created through the Advanced Rename dialog.

Example: Rename PRESET="Number Files"

You can add the ADVANCED argument to make the dialog open and allow you to make changes, or cancel the operation entirely, before the rename is applied.

Example: Rename ADVANCED PRESET="Number Files"

RECURSE

/S

(no value)

The rename operation will operate recursively on all files inside selected sub-folders.

Example: Rename PATTERN *.jpg TO *.jpeg RECURSE

REGEXP

/S

(no value)

Enables regular expression mode. The search pattern must be provided with the PATTERN argument, and the replace pattern with the TO argument.

Example: Rename PATTERN "(.*) - (.*)\.(.*)" TO "\2 - \1.\3" REGEXP

RENAMEMATCHING

/S

(no value)

Keeps files with the same stem and different exensions together when renumbering. For example, IMGP1032.JPG and IMGP1032.WAV when renamed would be given the same number.

Example: Rename NUMBER 0001 RENAMEMATCHING

SHOWPREVIEW

/O

(no value)

Displays the preview panel when the Advanced Rename dialog opens.

Example: Rename ADVANCED SHOWPREVIEW

 

 

no

Does not display the preview panel.

Example: Rename ADVANCED SHOWPREVIEW=no

SIMPLE

/S

(no value)

Displays the Rename dialog in simple mode.

Example: Rename SIMPLE

TO

/O

<new name>

Specifies the new name of the file to rename. This argument is also used to specify the 'to' pattern when renaming using wildcards or regular expression, and the 'replace' string when renaming in find-and-replace mode. This argument can also be provided without a value when doing a find-and-replace rename - in that case, the search string would be replaced with nothing.

Example: Rename FROM " (Copy)" TO FINDREP

TYPE

/K

files

Force the rename to only operate on files - any selected folders will be ignored.

Example: Rename PATTERN * TO *.bak TYPE=files

 

 

dirs

Force the rename to only operate on folders.

Example: Rename PATTERN * TO Copy_* TYPE=dirs