Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Name Mangler - A batch file renaming utility Pick of the Week
The macosxhints Rating:

[Score: 9 out of 10]
There are lots of utilities out there to help with batch file renaming, including Apple's own Automator, which includes some renaming actions. One of my favorite tools is Name Mangler, which has a (relatively) intuitive interface, and some powerful renaming features. Using a drop-down menu, you tell Name Mangler what you'd like it to do -- find and replace, number sequentially, change case, set extension, add prefix/suffix, or remove/insert characters. There's one more option here, Advanced, that I'll discuss in a bit more detail later.

The left half of the Name Mangler window shows the list of files that you'll be modifying. You can populate the list by drag-and-drop from the Finder, or by clicking a button to add the current Finder (or Path Finder) selection to the list. Next to each file is an example of how it will look when renamed, based on your chosen conditions. Those conditions are shown on the right half of the window, and are based (obviously) on which type of renaming you've chosen from the drop-down menu. The pre-defined change types will meet most of your needs, but for those times when you want to do more, the Advanced option offers a tremendous amount of power. Using Advanced, you can construct your own replacement rules, using Name Mangler's name conversion description language (NCDL). With NCDL, you can create your own rules with constants, variables, and functions. There's an Examples pop-up menu you can use with Advanced to see some sample queries, and the help file has more info on using NCDL. It's quite powerful, though building advanced NCDL tasks isn't for the faint of heart.

Once you've created a set of renaming rules, you can save them as a "droplet," which is basically a file that launches Name Mangler, activates your settings, acts on the files you've dragged to the droplet, then quits Name Mangler. (The behavior differs if you launch a droplet when Name Mangler is already running; check the help file for more details.)

I don't need to batch rename files all that often, but when I do, I find that Name Mangler works well for my needs.
    •    
  • Currently 2.25 / 5
  You rated: 5 / 5 (20 votes cast)
 
[50,848 views]  

Name Mangler - A batch file renaming utility | 8 comments | Create New Account
Click here to return to the 'Name Mangler - A batch file renaming utility' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Name Mangler - A batch file renaming utility
Authored by: asmeurer on Jun 09, '08 09:58:55AM

Does this support regex? Renamer4Mac recently went shareware, so another renamer that supports regex would be a boon for me.



[ Reply to This | # ]
Name Mangler - A batch file renaming utility
Authored by: phoobahr on Jun 09, '08 03:04:23PM
I've found myself doing most of my file renaming from the console. To make things easier I wrote this:

 cat $(which mmv)
#! /usr/bin/python

"""
mmv: Multiple move.
A small utility designed to rename files in the current working directory both matching against, and transforming the matches via python regular expressions.
"""

import re,os,os.path,sys
from optparse import OptionParser


parser = OptionParser(usage="Usage: %prog [OPTIONS] $regex_match $regex_sub\nExample: mmv -t \".*([0-9]*).mp3\" \"Track \\1.mp3\"",version="%prog 0.8.1")
parser.add_option("-t","--test",action="store_true",default=False,dest="test",help="Test. Display all output but do not commit new filenames.")
(options,args) = parser.parse_args()

if 2 != len(args):
	parser.error("Incorrect number of arguments.")
try:
	regex = re.compile(args[0])
except Exception,e:
	parser.error("Error parsing $regex_match.")
else:
	if options.test:
		mmv = lambda src,dst: "testing: %s:\t%s" % (src,dst)
	else:
		mmv = lambda src,dst: os.rename(src,dst)
	for ix in os.listdir('./'):
		if re.search(args[0],ix):
			try:
				dst = regex.sub(args[1],ix)
				result = mmv(ix,dst)
				if result == None:
					result = "%s:\t%s" % (ix,dst)
			except Exception,e:
				result = e.__doc__
			print result


[ Reply to This | # ]
Name Mangler - A batch file renaming utility
Authored by: Peter Maurer on Jun 10, '08 02:46:59PM

Yes, it does support RegEx (via PCRE).



[ Reply to This | # ]
Name Mangler - A batch file renaming utility
Authored by: asmeurer on Jun 10, '08 06:37:50PM

What is PCRE?



[ Reply to This | # ]
Name Mangler - why?
Authored by: thiefhunter on Jun 09, '08 10:45:02AM

Why this instead of Apple's collection of Finder scripts? I use them all the time, especially to batch rename camera imports.

---
Thiefhunters in Paradise



[ Reply to This | # ]
Name Mangler - why?
Authored by: DanFrakes on Jun 09, '08 01:18:40PM

Short answer: Name Mangler is *much* more powerful, with many more options and a much better interface. I also like that you can create droplets that perform specific operations.

---
Dan Frakes / Senior Editor, Macworld



[ Reply to This | # ]
Name Mangler - A batch file renaming utility
Authored by: FOOOD on Jun 10, '08 12:45:38AM

I used to use Automator workflows all the time, but when they broke in Leopard I started using the old version (File List I think it was called). Then carried on using this when it came out.

I only use it once a week, or once every couple of weeks but ended up preferring it to Automator, scripts etc.



[ Reply to This | # ]
Watch Out
Authored by: schneb on Jun 17, '08 12:55:48PM

Be careful. In my experiences, many of these renaming utilities will delete all of your Spotlight comments. So beware and test!



[ Reply to This | # ]