Hermes – The Regex File Mover / Renamer

Last year I found myself faced with the mammoth task of renaming and sorting thousands of files according to a strict set of rules. I couldn't find a piece of software to do exactly what I needed, so I wrote one. Hermes (named after futurama bureaucrat and legendary sorter hermes conrad) is a regex based file sorting application. It allows you to change the path of a file (which covers both moving and renaming) based on regex criteria.


Say for instance you have a folder full of images of paintings by famous artists. These are all in the same folder, and it's getting a little out of hand trying to sort them all. You started out with a neat naming convention
c:\art\Hieronymus Bosch - The Garden of Earthly Delights.png
c:\art\John Everett Millais - Ophelia.JPG
c:\art\Leonardo Da Vinci - Mona Lisa.gif
But now things are getting out of hand, and you want to sort them alphabetically by LAST name, not first. Then you decide you would like to group each artist's paintings into their own folder. Then you decide it would be best to group the image formats into different sub folders too. Now, you could easily rename all the files using a program like AntRenamer, or Albert Bertilsson's wonderful RenamerNG (my favourite), but how would you go about creating the folders for each artist?


That's where Hermes comes in. Hermes allows you to use Regular Expressions to alter the path of the files, which covers both moving AND renaming at the same time. Hermes would do the job above by using a RegEx string like
c:\Art\([A-Za-z0-9\.\&]+) ([A-Za-z0-9\.\&]+) - ([A-Za-z0-9\& ]+).([A-Za-z]+)$
and turning it into
c:\art\$2, $1\$4\$3.$4

As you can see from the screenshot the app is not very complete - still using the default Visual Studio icon for instance - but it does do what it's supposed to do, and does it fairly well. I'm working on an upgraded version but for now if anyone really needs it, download it here:

http://roryok.com/apps/Hermes/Hermes.v0.1.zip

Things You Need To Know:

  • It requires .NET 3.5 Framework or higher, you can get that here
  • It starts by default in C:\ and with Regex (.*) and recursive UNTICKED. If you tick recursive and hit process, it will iterate over every single file on your C:\ drive, which could take hours, so don't do that. Use the recursive feature carefully!
  • I accept no responsibility for any loss of data as a result of using this program. Use it at your own risk and for feck sake make some backups first. I would. Even if it works flawlessly, it's very easy to get your regex messed up and tell it do rename all your files to something random. Be CAREFUL!

PS: The screenshot is from an older build that was still called RegexFileMover - the version for download is called Hermes but I'm too lazy to change that.

Tagged with: ,
Posted in software
2 comments on “Hermes – The Regex File Mover / Renamer
  1. Alex says:

    Hello, I am trying to learn regex and using hermes...

    I want to move subfolders from

    C:\series 1 - season 1
    C:\series 1 - season 2
    C:\series 2 - season 1
    C:\series 2 - season 2

    to :

    C:\series 1\series 1 - season 1
    C:\series 1\series 1 - season 2
    C:\series 2\series 2 - season 1
    C:\series 2\series 2 - season 2

    How can I acomplish that ?

    sheers and congrats for your software... Can't find a similar one on the web.

    For a great renamer, please check out magic file renamer. Or MFR/ I like version 5 better than the rest.

    cheers

  2. rory says:

    Hi Alex

    I was just doing some blog spring cleaning and noticed this comment, which I completely missed out the first time. Sorry about that!

    I'm sure you've figured out the above or given up on it, but it would be fairly simple to do:

    Root Directory
    c:\

    Path:
    c:\(series [0-9]) - (season [0-9])

    New Path
    c:\$1\$1 - $2

    I think it might also support nested expressions but I can't remember. As always, BE REALLY CAREFUL. PREVIEW FIRST. Especially when things are in the c:\ root like that. In fact, I'd advise moving everything to a temporary folder before you do that. The consequences of accidentally renaming everything in your C drive can be disastrous!

Leave a Reply

Your email address will not be published. Required fields are marked *

*


3 − = two

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>