TLDR; Skip Down to the "Getting Started" section.
Once you learn a bit about KM, you will find tasks like this one fairly easy. But, like with all languages, you have to first learn the terms and definitions and syntax of KM. I think you'll find KM easier to learn than most. It is designed for non-programmers, but if you happen to be a programmer, that is to your advantage -- mostly from understanding how to construct the logic of any program, a KM Macro in this case.
So, let me give you some rough pseudo code, to help get you started.
this is not perfect, and I may have left out some small statements (KM Actions).
Do a For Each action with a Folder Contents collection
- This is like a repeat loop, with each iteration providing the filePath of the next file in that folder.
- The following are statements (KM Actions) in this "For Each" Action.
- The "For Each" will have a loop variable, we'll name "filePath", which is the full POSIX file path to the next file in that folder.
- Set a Variable (fileRoot) to the root of the file name of filePath
- There are several ways to do this, depending on your data
- If all of the files are then it easy to use a Search using Regular Expression action
- Let us know if you need help with this
- Use a formula or a Switch or Case action to set a Variable "DestinationFolder" to the destination path for this file
- For example, if the paths to all of your destination folders look like this:
~/Documents/Some Folder/<fileRoot> - THEN a simple Set Variable to Text action will work fine. Something like this:
Set Variable "DestinationFolder to~/Documents/Some Folder/%Variable%fileRoot%
- For example, if the paths to all of your destination folders look like this:
- Now use the Move File Action, something like this:
- MOVE: %Variable%filePath%
- TO: %Variable%DestinationFolder%
That's it!
Please feel free to ask any questions about this.
However, none of that may make any sense until you learn the basics of KM.
==So, I'd suggest that you start here:==
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Nickrs, welcome to Keyboard Maestro (KM) and its Forum.
KM is one of the best Mac automation tools available, its Forum is one of the best and friendliest forums on the Internet. Whenever you reach a tough stumbling block trying to use KM, please feel free to post your question/problem here for help.
You will also find this helpful:
Tip: How Do I Get The Best Answer in the Shortest Time?
Getting Started with Keyboard Maestro
- Read the Quick Start.
- This is essential to become familiar with KM terminology
- Do the tutorial (Help ➤ Tutorial) in the KM Editor.
- Gives you a live walkthrough of creating a macro in the KM Editor
- Review/Browse the Available Macro Actions
- For Help with an Action in your Macro, click on the gear icon
at the top right of the Action, and select "Help" - Search the Keyboard Maestro Wiki for detailed help.
- Start small, and grow your macros organically.
- Be prepared for some trial and error in the beginning.
- Make good use of this Keyboard Maestro Forum
- Checkout these Great Resources
- Search for existing macros
- Post your questions/issues if you get stuck
- Be sure to first read: Tip: How Do I Get The Best Answer in the Shortest Time?
For more help, see Getting Started with Keyboard Maestro and the Forum .
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~