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.
https://wiki.keyboardmaestro.com/action/Set_File_Attribute

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:
image
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.

Thank you for the suggestions!

I don’t have KM installed. I have an old license but it never clicked for me.

I tried. Never having done it before myself, I followed a few tutorials but couldn’t make it work. I kept getting errors on the script.

As with a lot of things in life, the solution was simpler than I thought: One step in an Automator Quick Action.
Here’s what I did, in case it helps others with the same need:

  • Create a new Quick Action in Automator
  • Drag the “Move Finder Items” to the workflow
  • Select the destination folder
  • After saving it, assign a keyboard shortcut in System Preferences → Keyboard → Shortcuts
  • Create a “Hotkey” button on the Stream Deck, input the same shortcut.

That’s it!

1 Like

Nicely done.

I am not a big Automator user, so it doesn’t tend to come to mind when I think about these things.

It’s amazing how many different things you can put together in MacOS to accomplish these kinds of tasks!