Renaming Your ‘The’ Folders

January 8, 2007

I was working on tagging and ordering my music collection tonight and had to decide what to do with all my artisit folders that are named leading with “The”, e.g. “The Weakerthans” or “The Strokes”. I decided to go with moving the “The” to the end so that “The Weakerthans” becomes “Weakerthans, The” and is placed with the W’s in an alphabetical sort.

To do this I used a nice one-liner that leverages the rename tool. It’s just a regular expression but it does it nicely.

I recommend running it with the -n flag first to make sure it’s going to do exactly what you think it is. I also came up with a line to do the reverse, just in case you decide you don’t like it that way.

Regular expressions rock.

Update (01/08/07)
Bonus! If you have all your music (or something else) organized by folders I recommend using the tree tool to get a nice text representation of your collection. I don’t know about other distro’s but it’s not installed in the default Ubuntu Edgy 6.10, so you’ll want to grab it with:

After that it’s a snap, just run it on your directory and divert the output into a file. Here’s my run on my music collection, and you can view the produced file here (11k)

Categories: Geek
Tags: , ,

Leave A Comment

Your email will not be published.