Prevent iTunes 8 from adding track numbers to filenames

As we’ve discussed in prior hints, iTunes 8 removed a number of preferences that were available in iTunes 7. In the Set some missing iTunes 8 preferences hints blog, I explained how to set four of the removed preferences—show genre when browsing, show links to the iTunes Store, play songs while importing, and load complete preview before playing. Today, I’m going to look at one of the more contentious omissions in iTunes 8—the removal of the preference to not add track numbers (and disc numbers, for multi-disc sets) to song filenames in the Finder.

Now, I’ll admit that this particular preference change was meaningless to me—I really don’t care, nor do I even know, what iTunes names my songs when it imports them. I use iTunes to make listening to music easier, and not having to care about filenames is a key part of the “making it easier” bit. However, I know this is a very important topic for many people who take a more active role in managing their music collection. So in today’s blog, I’ll explain how to disable the addition of track and disc numbers to filenames—and more importantly, perhaps, how to reverse the effects if you’ve already imported a bunch of music and noticed the filename problem.

If you’d rather not have iTunes add disc and track numbers to your filenames, quit iTunes, open Terminal (in /Applications -> Utilities), and type these two commands, pressing Return after each line:

defaults write com.apple.iTunes create-filenames-with-disknumber -bool FALSE
defaults write com.apple.iTunes create-filenames-with-tracknumber -bool FALSE

From now on, iTunes will leave your track names alone when you import new music. But what if you need to reverse a number of files that have already been renamed? It turns out that there’s a relatively simple fix for that one, too—courtesy of a thread (which I can’t seem to find) in the Apple Discussions forums. Please note that this will change the names of all your song files—I suggest making sure you have a good backup before you try this, just in case it doesn’t do what you hope it will do! With that said, here’s the suggested fix.

After running the above two Terminal commands, launch iTunes and open its preferences. Click on the Advanced tab, remove the check mark next to Keep iTunes Music Folder Organized, then click OK. Open preferences again, and toggle the Keep iTunes Music Folder Organized option back on and click OK. That’s it; iTunes should now move through your entire library, removing disc and track numbers from your songs’ filenames. I found this fix in this thread on the Ars Technica forums, where a user has confirmed it worked for them, but I have not tested it for myself.

If you’re one of those who pays close attention to your songs’ names in the Finder, the combination of the Terminal commands and iTunes preference toggle will restore your filenames to their previous state, and make sure that iTunes doesn’t mess them up again in the future.

Subscribe to the Apple @ Work Newsletter

Comments