Move Files in a Given Directory IF They Match a Certain File-Type

Hi Everyone,

So I am very new to Keyboard Maestro and am getting confused on basic things! I am currently doing a training course but it's not covering my specific questions.

I am trying to filter certain files in a folder and then moving files that were not filtered out.

So I have a folder and it has 8 files inside, I need to create a macro that will take the contents of the main folder (the 8 files) and filter some of them out if they meet certain criteria.

For example if 4 of the files are pdf and the other four are jpeg files I want Keyboard Maestro to only copy the jpeg files to a folder of my choice!

I would have thought that this would be quite a common question but I cannot seem to find an answer (that I can understand) anywhere including this forum :neutral_face:

Not sure if my question is too basic or if I am overlooking something?

Thank you for your help, it will be interesting to see how this works as I want / need to learn :smiley:

Hey @Margate,

You've set yourself a fairly advanced task here.

You don't know Keyboard Maestro well enough yet to know what to search for, and that's to be expected for newbies. It gets easier with time and experience.

Appended is an example macro.

Many people only use one For-Each action, but I prefer this method – so I can easily turn off the move actions and preflight what's going to happen.


Download Macro(s): Move Files According to File-Type Filter v1.00.kmmacros (13 KB)


  • 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

Hi Chris,

Yes you're totally right, I don't even know what to search for if I did that would be a start!

I am too used to Automator and it's far easier but far less powerful. I really want to have a good understanding of how Keyboard Maestro works.

Thank you so much for taking the time to create this code for me. It's very handy because I can see what needs to be done and learn how to do things like this myself from it. It looks complicated but I follow what it is doing, just need to spend some time working out how to set something like this up myself but it will be a far easier learning process now thanks to your help