Copying File to a Selected Folder

I'm trying to make a macro to copy selected files to a selected folder (always same folder).
How can I do it?
Thank you.

Try this.

How did you do this?

Thank you for your answer, Gregwarrior, but still I don't know how to do it.
Maestrokeyboard is no that easy for me.


1 Like

No problem @Guillem & @Schnell_Thomas... we all started small :wink:

Just click on the macro link here and it will be imported into your Keyboard Maestro Editor. Please don't forget to activate it.

Copy to folder.kmmacros (2,1 KB)

You only need to create a folder in the Finder where you want to copy the files. Then please select the Finder folder in the KM macro.
For a better understanding, here is a short video tutorial:

If you have any questions, please contact me.

1 Like

really cool! thx @appleianer!

can one also use the to path and auto create a dated folder when i copies the file?

ie something like

where the %DATE is the current ISO date?



Hi @zeltak, I can help you with that. Before I send you a macro I wanted to ask if you use TextExpander, aText, Typinator etc. on your Mac?

I @zeltak use a macro to quickly and efficiently organize my desktop.
I create a folder with date and title from a selection of files and move it to mine. GTD folder to be able to arrange them at the end of the day.

In my example, I've now stuck with your wish to "copy the files to a folder in the Finder".

Of course you can change the date format (red arrow).

GTD Eingang : KM Date.kmmacros (3,9 KB)


However, I prefer a solution where I can use a KM popup window to select a specific date format via a TextExpander snippet.
The advantage is also that I can have the TextExpander window displayed in the middle of my desktop, which makes my input more comfortable.
At 27 inches a blessing for my eyes :wink:

Thx alot @appleianer, really appreciate you answer and help!

i have a few issues with this method.
fitst of all it dosent seem to reliably work here. also if i try and copy a file right after that there is a folder name conflict.
most important issue is that i want to to copy the folder to a different location and then create a folder there (with the date)

so the ideas scenario can be seen in this workflow example

go to ~ in finder.
stand on ~/.emacs.d/
issue the macro
the ~/.emacs.d/ is copied to ~/BK/emacs/01012019/

i thought perhaps there was a placeholder for date/time one could enter in the path for the copy/move dialog? like this:


if not is it worth putting in a feature request :D?

thx again


Hey Z,

You can do something like this:

Copy File to Dated Backup.kmmacros (6.2 KB)


There is. Use this token:


thx @JMichaelTX and @ccstone this is exactly what i was looking for!

in a related question. i wonder why using a variable to be used to create a folder name wont work. i have this:

it gives me an error and wont copy it to a folder named %Variable%Name%

yet it does work in the display text and show the correct value for %Variable%Name%

any clue?



Hey Z,

The example I gave above does use variables.

You didn't provide a downloadable macro, so we can't fully see what you've done or test it.

Best guess is that either you've fouled up the path in a way you're not seeing – or there's already a file at the destination.

Keyboard Maestro will NOT overwrite files for safety sake.

You have to delete them manually before using a move/copy/create action.

OR you have to resort to the shell.


sorry @ccstone for not posting the full macro
attached is the macro as requested
i tried to used your example with the variables but cant get it to work

thx again for all your help

Copy to BK.kmmacros (3.0 KB)


Hey Z,

Your problem becomes pretty evident when you run this version on a single selected file:

Copy the path out of Keyboard Maestro and paste into BBEdit, so you get a nice mono-space-font view of it.

If that's not clear report back, and I'll walk you through it.


Copy to BK -- ccs -- 01.kmmacros (4.7 KB)

thx again!

i guess im an idiot and you will have to walk me through :smiley: :smiley:

the display text does seem to show the correct use of the path+date


so im not sure what im missing :smiley:

Hey Z,

I went back and looked at your original question again. Apparently I misread it and missed the auto-create part.

Keyboard Maestro cannot auto-create folders during a copy or move action.

If the folder does NOT exist you cannot copy or move to it.

Sorry for the confusion.

So – you either need to employ a New Folder Action or resort to the shell.

Personally I like to use mkdir -p in the shell, because it creates intermediate directories at need and fails silently if the directory already exists.

(There's also an AppleScriptObjC routine for this.)


1 Like

cool! i come from years in the linux world so i know and like the mkdir -p command :smiley:
can the shell command take the %ICUDateTime%yyyy-MM-dd% and %variable%Path% inputs?
and if so would you mind pasting an example?

Though of course it can check for the existence of such a folder, and create it if necessary...

Hey Z,


But you can read Keyboard Maestro variables in the shell.

Execute a Shell Script

See the “Using Keyboard Maestro Variables” section.

You can also use date in the shell of course:

date "+%Y-%m-%d"