Using wildcard characters to move certain file

Hi there. This is probably a stupid question but I can’t seem to figure this out. I’m trying to move certain files in a folder. Eg. I would like to move all the zip files and trying to use the move or rename file action.

when input say a path like this “~/Desktop/Folder/*.zip” it will not work. It only works if type the full file name.

Anyone know what I am doing wrong? Much appreciate your help. Thanks

Hey Pascal,

Not stupid at all – just lacking knowledge.

Keyboard Maestro’s move and rename functions don’t accept file-globbing like the shell.

You’d need to get the paths of every file and then use a For Each action to iterate through them.

If you’re familiar with the shell you can use an Execute a Shell Script action to streamline the process.

-Chris

1 Like

Thanks Chris!

That works! I used a simple one line shell script using mv command

1 Like

Not stupid at all -- a very good, logical question.

In response, I have built the following macro, that I just posted:
MACRO: Files Move Files with Ext in Folder [Example]

While the meat of this macro is just one, fairly simple, shell script, it can be useful to have a nice KM wrapper that makes the process easy and safe. Sometimes just one minor error in a shell script can be catastrophic.

1 Like