Renaming files in subfolders

My photo editing process results in filenames with one or more "-Edit"s in them. I would like to be able to search through a set of subfolders for names such as “DEB_4135.NEF_093630-0800-Edit-Edit.jpg” and rename them to DEB_4135.NEF_093630-0800.jpg. I couldn’t figure out how to find and retain the first part as well as look for one or more instances of the “-Edit”
I would very much appreciate help!

Are you using any sort of third-party software to edit the filenames, or are you just referring to doing a search in the macOS Finder, and manually editing the filenames?

Pending the answer to @george_c’s question, I believe you could do this quite easily in a couple of ways (including something like a shell script), but Hazel springs to mind as probably the most user-friendly if it’s an option you already have available:

  1. For the condition you would use ‘Name contains -Edit’.
  2. Then, under ‘do the following’ you would use the ‘Rename’ rule. Click on the little right arrow to the right of the ‘name’ token and hit ‘Replace text’ then replace -Edit and leave the ‘with’ field blank. (Screenshot attached in case it helps make this clearer)

Screen Shot 2021-03-15 at 11.37.03 pm

2 Likes

This solution makes perfect sense if have Hazel and if you want this to be an ongoing correction.

If this is a one time or seldom event, you can do @Kaitlin’s solution through Finder as well.

1 Like

I am using a combination of Adobe Lightroom and some plugins. Each edit modifies the filename. When I’m done editing I export to share with clients. I want to monitor that export folder (and subfolders) to rename the files.

yep, that would be a Hazel thing for sure.

1 Like

This is what I have been doing. But I am adding these files to a Dropbox folder for a client - who will have immediate access. I export immediately after editing so they can be published quickly as needed (I’m a sports photographer). I don’t want the -Edit names there for the clients to see, and I also don’t want to go rename files every time I export - which can be hundreds of files one at a time (every minute or so). It is something I need to do rapidly.

Thank you. I am going to try this. Is there a way to monitor subfolders within a parent directory?

Gotcha, then Hazel is the best $30 you will spend today!

You can have it dig into subfolders for you and do this rename there too:

1 Like

Wow, I had no idea this was an option! I’ve always used a third-party tool for this kind of thing. Thanks for sharing; always great to learn something new. :slight_smile:

There sure is! It’s not totally intuitive, but there’s a page about it here:

https://www.noodlesoft.com/manual/hazel/advanced-topics/processing-subfolders/

1 Like