Stream Deck button: move selected files to specific folder. Help!

What I want to achieve seems simple, but somehow I can’t figure it out.

I want to create a button in Stream Deck that moves all the files I select in Finder to a specific folder.

I know that Hazel exists (it’s crucial to my file management btw), but…
I always have random files that don’t fit a specific criteria or rule, that I need to move to some of my most used folders.
Hence the Stream Deck button.

I’m trying to reduce mouse interaction such as drag and drop as much as I can and a button would be much faster and accurate than dragging files around anyway.

I tried to create a Shortcut, but the “move file” action only works with one file at a time.
If I select multiple files and run the Shortcut, it prompts me to select one of the files.

I ran out of ideas, any input is appreciated.

I haven’t tried it yet, but what about adding a tag with the button to the file, and let hazel look for this tag, to move the file (and remove the tag after the movement of the file)?

It seems, that KeyboardMaestro has an action that could be interesting for the setting of the tag.

It’s a possible solution, thank you.
I’ll see if our fellow power users come up with other options.

If you have Keyboard Maestro, it is a relatively easy task. You can have KM iterate through the current Finder selection, which can be multiple files (or folders or both). On each loop move the selected item to the target folder.

If you want you can create one macro for each location you might want to move files to, and have a button on the StreamDeck to action each macro. Alternatively, have the macro take a parameter which you pass in with each button on the SD. Either is easy to do.

I use this approach in a lot of ways. One is that I have buttons on the SD that trigger a macro that adds or removes tags from whatever is selected in the Finder. Another finds the last file added to the Downloads folder and moves it to my Inbox folder (there’s also a version that lets me pick the folder to move the last added file to).

If you are not sure how to do this on KM I can post sample code.

If you don’t have KM, I would probably do this in AppleScript. I haven’t tried, but I would suspect it is part of AS to be able to get the Finder selection and then iterate through it moving files. Again I could test this out and post code if you are not sure how to do this.

If you have KM I would recommend that approach. I have the feeling that KM is more likely to remain reliable than AS at this point.

You could use the “repeat with each” action to move them :nerd_face:

In this case, I believe it is actually the “For Each” action, which is used to loop through collections. The “Finder’s Selection Collection” is set as the target for the “For Each” action. On each loop you will have an item from the current Finder selection to work on, which you can use to move, tag, etc as desired.

In fact, the Keyboard Maestro Wiki provides this handy example:
which I imagine would work for the OP. Of course, a parameter could be passed in to the macro and used in the “to” entry so one macro can be used for many targets, and it’s easy enough to add that parameter to each StreamDeck button.