Move files from a folder based on name

Hello I'm trying to create a macro that pick every item from a given folder and move the files according to it's name. I've been working on the script for more than an hour, no luck, I need help from more experienced people here

image

Hey there, welcome to the forum!

While I’m a fan of bash scripts, you can actually do this with native KM actions. Here’s a sample macro you can test out. Please note that you can delete the alert actions after testing if you want; I just put them in there to alert you before anything is actually moved so you can verify that the locations are correct.

Download Macro(s): Move video directories.kmmacros (5.8 KB)

Macro-Image

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.6
  • Keyboard Maestro v10.2

hey @cdthomer , thanks !
I imported your script, enabled it, but when I try to run it nothing happens (not even the alerts, which I didn't disabled or deleted) ... sorry, I'm new to KM

No worries, here’s a modified version to help debug the issue. There’s an alert basically between each action to see where the macro is failing (or if it’s even triggering). Alternatively, you can enable the Macro Debugger feature to see more info in real time.

-Chris

Download Macro(s): Move video directories.kmmacros (8.2 KB)

Macro-Image

Macro-Notes
  • Macros are always disabled when imported into the Keyboard Maestro Editor.
    • The user must ensure the macro is enabled.
    • The user must also ensure the macro's parent macro-group is enabled.
System Information
  • macOS 13.6
  • Keyboard Maestro v10.2

weird, all debug messages are shown, but nothing happens after that