Automatically duplicate files


This is my scenario: I download music often using a special program. This program downloads the music in a dedicated music folder and automatically sorts it using folders. E.g.: artistfolder>albumfolder>songfiles. It is only possible to have one output folder in this program but I would like to have a second one for safekeeping on an external drive. Until now I have been copying it all manually but this just feels like a barbarian way to work. So now I am wondering if there is a way to make KM automatically copy the newly added folders and files into another folder whenever one is added.

Thanks alot!


KM does have periodic triggers, but I'm not aware of any file system triggers.


Hazel, which is a useful complement to Keyboard Maestro, is specifically built around file-system triggers.

Ah – perhaps the Folder trigger in KM ? I haven't used that.


You can use the Folder trigger to trigger on a file being added to a specific folder. You could then have Keyboard Maestro copy that file to your music folder (which would then presumably be sorted in to the desired folder).

Yup, KM Folder Triggers basically negate the need for Hazel altogether, I feel. Admittedly, I was never hugely enamoured with Hazel as are other people, because it wasn't doing anything for me that a macOS Folder Action couldn't do. But, surprisingly, I do find KM's implementation of it more intuitive than Hazel's and less opaque than a macOS Folder Action.

Anyway, conclusion: Folder Triggers = very useful things.

I thought/felt the same.

With KM’s Folder Watch trigger you can “only” track this:

  • Removal of a file
  • Addition of a file

…while with Hazel you can track Date Added, Date Last Modified and whatnot.

Certainly both are milking the system’s FSEvents, but it seems Hazel can get more out of it.

That being said, Hazel is not always superior to KM. See this macro: I first tried to use Hazel to get the required FS information. It failed. But —to my surprise— it worked with KM. (It’s annotated in the macro post.)

So, probably both, Hazel and KM’s Folder Watch, have their use-cases. But I tend to not buy the next version of Hazel, since it’s very specialized and I rarely have the need for it. (Although it’s very good at what it is doing.)

I have a macro in KM that periodically checks a "watched" folder to determine if any of the files in there are older than a certain age, and act upon these accordingly. Although this doesn't fall under Folder Trigger, but under Periodic Trigger, the effect is the same as Hazel "tracking" Date Added in order to initiate a rule set.

Could it be that KM's functions are just more "spread out" under different categories, whereas Hazel groups everything in a more inter-connected user experience ? Hazel has a lot of useful pre-defined "actions", whereas KM might require some scripting to reach the same goals.

I'd be interested to know how each of these pieces of software does go about achieving their objectives under the hood.

Well, I always thought that a Periodic trigger is… just a periodic trigger. To my knowledge there is no trigger setting (linked to the Periodic trigger) that refers to file changes or something like that.

But probably I’m missing something, so please give me a hint.

As said, this is just FSEvents, provided by the OS.

You can also query/observe FSEvents “manually” with one of the tools mentioned in the above mentioned macro post. (filemon and FSMonitor.)