Any way to trigger Folder Action when adding file to any subfolder

applescriptautomatorfolder-action

I've created a Folder Action in Automator and applied it to a folder. But it only gets triggered when a file is added to the root of that folder, not to one of its subfolders.

Is there any way to get Folder Actions be trigger when changes occur in subfolders?

(And, no, I do not want to apply the Action to each subfolder; they are always changing, so I need it to be dynamic.)

Best Answer

Without writing a full-blown Objective-C app, this is pretty difficult to do well.

I wrote something you might be able to use a while back. Just put it up on Github here. It's a Ruby script that you should be able to use as long as you're comfortable in a shell and text editor. No Ruby knowledge required.

It's a bit dumb, in the sense that it just runs a shell command when a change is detected in the watched folder (or subfolders). You can use that to call an Applescript though. Should be some way to do the same for Automator workflows.

However, if you depend on the input from the folder action (i.e. the files/folders that triggered the action), this won't work.

You could probably modify the Ruby script to catch the path of the files/folders triggering the event, and then pass that to an Applescript or Automator action, but I didn't need anything that complex, so I just hacked this together.

Good luck.