Match and Move by a Partial File Name

Okay, so my problem is that I'm trying to take images that are exported from Adobe Lightroom and and move them to my edits folder at the end of every day.

These aren't the only things that land in my downloads folder though – or even the only jpgs.

The naming scheme of these files in regex are:

MG(.*)\.jpg

I don't really know where to start from here. I'm kind of still learning the tool.

Any help is appreciated.

Hi Randy - welcome to the KM forum!

Given that, for example, MG23pjpg and MG-99Solway Firth!jpg are both a match for the regex you provide and neither look like probable image filenames to me, I think you really need to provide some actual examples of real filenames so we can derive the actual regex pattern that applies.

Hi Randy, try this macro. you will have to edit for the correct directories. I suggest you test this macro on a small sample of files. I did modify the Regex to MG(.*).jpg check the file list then enable the disabled actions. I did not set a trigger but just ran it from within the KM editor.

Copy jpg files to new directory.kmmacros (5.8 KB)

I'd start with "Why are you exporting them to your Downloads folder?" Even if you want to collect exported images in one place during the day then move them to another at the end, you'll save yourself a lot of trouble (and a lot of unnecessary processing!) if you use a different, dedicated, folder for your exports.

Sorry it's actually removing the underscores from the text.

2 example of a filename are:
_MG_0715-Enhanced-NR-2.jpg
_MG_0715.jpg

It's the typical Canon scheme off the camera.

Thank you so much that worked flawlessly.

Thanks @randywolf244.

With your examples I'm going to use the following regex _MG_\d{4}.*\.jpg in this macro. You should change the paths in the two actions coloured red to suit your own system and obviously change the hot key trigger as you see fit.

Although I've tested this on my system, things may be different on yours so I strongly suggest you create some test folders containing files you don't mind losing to make sure it works as you expect it to.

Let us know how you get on :grinning:

Download Macro(s): Test - Match and Move by a Partial File Name.kmmacros (4.3 KB)

Macro-Image

Keyboard Maestro Export

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 10.14.6
  • Keyboard Maestro v10.2

It's purely out of convenience.

I have my downloads folder in my dock so I have constant access to it. It makes it easy to export my images, and then upload to my socials seamlessly.

You can add any folder to your Dock, so you needn't forego that particular convenience. But it sounds as though your Downloads folder is a lot better curated than mine -- I'd have to check 100s of files to find the few that needed to be worked on, which would make a separate folder a much better choice!

Thank you very much. That worked flawlessly. You're a life saver. I now have this macro running three times a day.

That's great to hear Randy. If you have any further questions feel free to ask :wink: