I need a macro that can move the selected files from their current folder to another folder in the same main project folder.
The folder that the files are going to is always called the same, but the main project folder will never be called the same.
I’ve attached a screenshot that shows how the project folder is built up. So in this example I want to move the files in the “Location” folder to the “Destination” folder by selecting the file and run a macro.
My idea was to copy the files path and edit the path from:
/Users/kristian/Desktop/20220706 - Project folder/PT/20220706 - Project folder/Location/File 4.png
/Users/kristian/Desktop/20220706 - Project folder/Destination
But I couldn’t figure out how to edit the clipboard before using it as a variable.
I would say, the tricky bit is going to be the logic of how you edit the file path. Is the new folder always a certain number of folders higher up in the path? That was one approach I could think of.
But if you've already worked out the logic of how you are going to edit the path, the below Keyboard Maestro Actions should give you the building blocks to capturing the path to a Variable and using an edited Variable to move files.
Instead of using the clipboard, you can use Keyboard Maestro to capture the file path of the enclosing folder of the selected files in the Finder directly to a Variable:
EXAMPLE Get File Path to Enclosing Folder of Finder Selection.kmmacros (3.6 KB)
In the above example the enclosing folder's file path is saved to the Variable LOCAL__Path
Then you could edit this path to the new path and resave it as LOCAL__Path
Then, in the same Macro, you could use the Keyboard Maestro Actions below to move the same selected files to this new location:
EXAMPLE Move Finder Selection to Enclosing Folder.kmmacros (2.5 KB)
Further to @Zabobon's thoughts, here's something that should do it for you, assuming the Destination is always the same number of steps higher in the path.
Move Selection to Destination Folder.kmmacros (22 KB)
This is really clever and a great use for the
Filter Action. I always forget that Action exists and has so many uses.
Thanks a lot. This Worked perfectly!