Renaming

Name Mangler works its magic through renaming actions, which can be used individually, or combined together for multi-step renaming tasks. Here's a detailed look at each renaming action available in Name Mangler.

To get the most out of this section, you should either already be familiar with Name Mangler's interface, or have recently read both the Interface and Getting Started sections of this help.

 

Find and Replace

Find and Replace is used to find some text within a given set of filenames, and replace it with other text; here's how it looks:

find and replace

The box with the magnifying glass is where you enter the text you'd like to find (in the original filenames).

The Query is a regular expression checkbox tells Name Mangler to interpret the text you've typed in the find box as a regular expression.

Name Mangler uses Apple's built-in regular expression API in free-spacing mode. Please see Settings for more information on the regex engine and how to disable free-spacing mode.

Regular expressions are a powerful though complicated method of manipulating text. If you're brand new to using them, you might find this basic primer on Rob's personal blog useful; it walks through an example that moves dates around in a filename.

With the regular expression box checked, you'll see an indicator in front of your search terms, showing the status of your regular expression. Depending on what you've typed, you'll see one of three indicators:

regex

The silver dot appears when you check the Query is a regular expression box; the red dot (on a red background) appears when there's an error in the regular expression (a missing parenthesis, in this example); and the green dot appears when the entered regular expression can be successfully parsed.

To reference marked subexpressions in regular expressions, use the syntax $n, where n is the index of the subexpression, starting at 1. This replaces the \1, \2, etc. construct that you might know from other regular expression implementations.

The Ignore case setting tells Name Mangler not to consider case when determining what is or isn't match, and the Replace with box is where you put the text that will replace the found text. The Plus sign at the right brings up the Name Mangler metadata browser; please read the Using Metadata section of help for more details—many more details—on how to use metadata in your renaming operations.

Finally, Preserve extension tells Name Mangler not to consider the file's extension when doing find and replace matches. That is, if you have doc in your "find" terms, as long as this box is checked, Name Mangler won't do any replacements to the .doc extension on your Word files. See Filename Extensions for more on extensions and Name Mangler.

 

Sequence

Sequence lets you insert a series of letters, numbers, or Roman numerals in your renaming action. In its default mode, which adds Arabic (numeric) sequences, the dialog looks like this:

sequence

The Format pop-up lets you choose the type of sequence you'd like to append to your filenames:

sequence type

Arabic: 1,2,3… is the traditional numeric sequence, or you can choose between upper and lower case Roman and Letters (alpha) options. The last entry, Arbitrary Terms, is a bit of a special case: it lets you use a list of terms as your sequences; see below for more on using the Arbitrary Terms feature.

The Group by box has a special role: It allows you create independent series of sequence numbers when something that's shared in common amongst the files changes. That may sound confusing, so consider this example folder structure:

folder structures

If you drag the top-level "Clouds" folder into Name Mangler, you can rename all the files in all four folders. If you were to simply add a sequence number, the first file in the Day 1 folder would get sequence number 001 (or however you set it up), and the last in the Day 4 folder would get number 014. But you might prefer that the files in each unique folder get their own set of sequence numbers, starting over at one each time.

This is when you'd use the Group by box. Click on the plus sign at the right of that box to enter Name Mangler's metadata browser—the Group by box is only useful with metadata fields; while you can type in the box, your text will be ignored.

When the new pop-up dialog appears, type Name of and notice that "Name of Parent Folder" has auto-populated in the list. Select it to add it to the box, set up your other sequence options, the sequence numbers will be independent for each parent folder. Here's how it looks fully set up:

group by sequence

In the below image, the new filename has been set to include the name of the parent folder plus the original filename, so you can see how the sequence number is starting over for each new parent folder:

example of group by

If you have a folder with only one file, and you don't want that file to have a sequence number, click into the Group by box, then select EditInsert Laziness Indicator. You'll see a bed icon appear (lazy…bed…get it?), and now any time an item would have only one sequence number, it will be skipped instead. This works even if you're not otherwise grouping sequences, too.

For each sequence action, you specify Start at and Increase by values, along with an optional Prefix and/or Suffix (again, use the plus sign to add metadata in these fields). When using Arabic (numbers), you can also specify a minimum number of digits, or let Name Mangler decide how many are needed.

Finally, the Preserve extension checkbox tells Name Mangler to retain the extension when sequencing. See Filename Extensions for more on extensions and Name Mangler.

When you insert a sequence, it will replace your entire filename. This is by design. As such, you will almost always want to use Prefix or Suffix to include your filename as part of the sequence. To use the original (unaltered by any prior steps) filename, click the plus sign and select Original Name from the metadata pop-up. To use the name as modified by any prior steps, use Name from the metadata pop-up.

 

Arbitrary Terms is a special type of sequence that lets you provide the sequence data. (For users of older versions of Name Mangler, this is where the Terms List action moved—it's not gone, it's just got a new name, new location, and more power.)

When you select Arbitrary Terms, the input area for Sequence changes just a bit:

arbitrary sequence

You can input your desired terms two different ways. First, you can type directly in the Terms box—separate each term with a comma or line break, like this:

sequence terms

You can also input CSV-formatted text directly in this box, as long as it conforms to the basic rules for CSV files.

The second, and more powerful method, of using Arbitrary Terms is to click the small paper-like icon at the right side of the input box. When you do, Name Mangler will present the standard macOS file dialog, and you can point to any CSV-formatted text file as the input source. As long as the file conforms to the basic rules for CSV, Name Mangler will use its contents for your terms list. In other words, you can use this feature to rename your files based on names in a file.

When selecting a file-based terms list, you need to decide whether Name Mangler will check that file for changes, or simply read it once and not worry about future changes. You control this behavior through this checkbox, which you'll see at the bottom of the dialog that appears when you click the paper-like icon:

automatic file monitoring

If you check that box, Name Mangler will check for changes to the file each time you use this renaming action; leave it unchecked, and the file is read once then never checked for changes.

Once you've got your terms input, Name Mangler will use them as the sequence numbers. If you've provided fewer terms than you have files to rename, Name Mangler will recycle the terms, looping from top to bottom as many times as necessary.

If your renaming operation will result in duplicate filenames, your terms won't loop around unless you've enabled the "Make resulting filenames unique" option in Name Mangler's Settings.

 

Compose

The Compose action lets you toss out an existing filename, and start over with a blank slate. As such, it's typically most useful in a multi-step renaming operation. The configuration window is quite simple; a blank input box for your text, and the Preserve extension option, which will keep the files' existing extensions while discarding the remainder of the name:

compose

There is one way you can use the Compose action on its own: you can use it to replace filenames with strings of random characters, using Name Mangler's metadata capabilities. Click the plus sign at the end of the input box to bring up the metadata browser, then type Random; when you see Random Characters come up in the results, click it to add it to the input box.

Once Random Characters is in the input box, you can click on the small triangle in its highlight area to set some options for how your random string will be created:

random

Set those options as you like, and you can rename your files in a totally random manner.

 

Add Prefix

This action is quite simple, and allows you to add a prefix at the start of your filenames. In addition to the text input box, there's only one option, Preserve extension, to insure that your suffix doesn't replace an existing extension

prefix

Note that the Prefix input box has a plus sign, which means you can use Name Mangler's metadata in this field. See the Using Metadata section of help for more details on metadata.

 

Add Suffix

This action allows you to add a text suffix at the end of your filenames. In addition to the text input box, there's only one option, Preserve extension, to insure that your suffix doesn't replace an existing extension:

suffix

Note that the Suffix input box has a plus sign, which means you can use Name Mangler's metadata in this field. See the Using Metadata section of help for more details on metadata.

 

Insert

Insert allows you to insert text anywhere within your filenames, and you can determine the text's location by starting at either end of your filename.

insert

To use, fill in the text to insert (the plus sign indicates metadata is available; read the Using Metadata section for more on metadata), and then set the at index value to the location where you'd like the text inserted. An index value of 1 is the start (or end; keep reading) of the filename.

The Count from the pop-up menu determines where the at index value is based. If set to [start], then an index value of 1 is at the start of the filename. If set to [end], then an index value of 1 is at the end of the filename.

 

Remove

Remove allows you to remove text from anywhere within your filenames, and you can determine the location of the text to remove from either end of your filename.

remove

Set the Remove box to the number of characters you'd like to remove, and the Start at index box to the location from where you'll start removing those characters. An index value of 1 represents the start (or end; keep reading) of the filename.

The Count from the pop-up menu determines where the at index value is based. If set to [start], then an index value of 1 is at the start of the filename. If set to [end], then an index value of 1 is at the end of the filename.

 

Change Case

Use this action to change the case of your filenames, their extensions, or both.

case

The pop-up menu next to Name and Extension control how the case will be changed for each part of the filename. The available options are:

 

Set Extension

Use this action to set or change the extension on your filenames.

extensions

Type the extension you'd like to use in the Extension box (you can use the plus sign to access Name Mangler's metadata browser—see the Using Metadata section of help for more details on metadata.)

If you check the Change existing extensions only box, then Name Mangler won't create new extensions for files that don't currently have them.

 

Advanced

Advanced mode is used to write commands in Name Mangler's built-in programming language. Using Advanced mode, you can perform all sorts of complex renaming operations. Before diving into Advanced mode, you should be comfortable with basic programming techniques.

Please see the Advanced section for an in-depth look at Advanced mode.