How do you attach a Folder Action to a folder?

Sorry if this information is somewhere else in the forum, or even on this page. How do you attach a Folder Action to a folder? In my previous system (10.8) I had a folder action just like this, that watched the desktop for Screen Shot files and moved them to another folder. However, I can’t get the folder action attached, or if it’s attached it isn’t triggering. I embarrassed to say that I have spent a fair amount of time on this, including web searching.

Try a forum search on “folder actions”.

Unfortunately, Discourse doesn’t seem to support searching for phrases. (Or if it does, please tell me how.) So searching for “folder actions” gets anything that contains either folder or action (I think), though the ones with the phrase “folder actions” appear first (I think).

In any case there is very little about attaching an action to a folder in those posts. Discussions assume you know how to do that. I’ll read them more carefully. (In any case the discussions are fascinating and show many things that will turn out to be useful for me.)

My problem is that I had folder actions working on my 10.8 system, including one that moved screen shots off to another folder as soon as they showed up on the Desktop, but I can’t get this working on 10.11. I have tried a number of things and did a number of web searches but just can’t make it work. That’s why I thought I’d just ask straight out how to attach the action to the folder.

And maybe others will encounter this topic and find it useful without delving into the depths of the other discussions.

In place (or complement) you can try:

https://www.google.fr/search?q=site:forum.keyboardmaestro.com+"Folder+trigger"

– Alain

Exactly. And in the top 3 or so lies the answer to your question, which I found quite easily. :wink:

Bear with me here. I have used Folder Actions in 10.8 and earlier. (They worked somewhat differently in different versions, especially in terms of turning them on.) I can’t them working in 10.11. I’m not saying they don’t work, I’m saying I am missing a piece of information to get them to work.

I had found the post you highlighted. It shows a little dialog for Folder Actions Setup. There is no such thing on my 10.11 system.

According to the information I found I am supposed to put the Scripts menu on the menu bar, which I did. (I don’t remember how.) Then, from that menu, I select Folder Actions > Enable Folder Actions. Then again, I select Folder Actions > Attach Script to Folder.

Now, there is a problem that there are two places in ~/Library that folder action scripts can be put: ~/Library/Scripts/Folder Action Scripts and ~/Library/Workflows/Applications/Folder Actions. If I put a workflow/script in the first location, it shows up in the Attach Script to Folder menu. If I then select it and select a folder, it gets moved to the second location and no longer appears on the menu for Attach a Script to a Folder.

In any case, I’ve experiment a lot and can’t get anything to happen. Running one workflow from Automator did work, but not when attached as a script.

Also, is there any way to view what scripts are attached to a folder?

[quote=“MitchellModel, post:3, topic:3727”]
Unfortunately, Discourse doesn’t seem to support searching for phrases. (Or if it does, please tell me how.)[/quote]

Sure it does. Quoted searches were supported around v1.2 of Discourse.

"Folder Action"

See the Options link in the Search dialog. Read the help text toward the end.

-Chris

Hmmm, so it does. Must have done something wrong when experimenting to see if it did. Thanks.

Right-click on a folder in the Finder.

Go to “Services” in the Contextual Menu.

Then go to “Folder Actions Setup…”

Don’t forget to ENABLE folder actions in the Folder Actions Setup dialog.

-Chris

Don’t forget that Keyboard Maestro has a Folder Trigger of its own.

-Chris

That would probably be the easiest way to accomplish the basic kinds of operations such as “when a screen shot is added to the Desktop folder move it to the Screenshots folder”, though I haven’t tried it. Maybe someone has a few of these to share?

I don’t think Setup Folder Actions was on my Services menu. But I have worse problems now: my Services menu is corrupted. There are very few services (whereas before there were probably about 30), even though I had quite a few checked in the Services section of the Shortcuts tab of the Keyboard PreferencePane. The only way I know to refresh the services menu is

/System/Library/CoreServices/pbs -u

from the terminal. It made slight change, but didn’t fix it. In any case, there is no Folder Action Setup on that menu.

I logged in as a default user and it was there.

open /System/Library/CoreServices/Folder\ Actions\ Setup.app/

from the terminal gets me the Folder Actions Setup application.
I can then attach my services to folders. I still have no Folder Actions Setup item on my Services menu. I don’t know whether I will if I ever figure out how to restore the services.

Search the forum for “folder trigger”

-Chris

Hey Mitchell,

I’d be very concerned about this – corruption in one place on OSX often means damages system or damaged disk.

I’d boot into my recovery partition and do a disk check.

I’d also try rebuilding launch services with Onyx, although it can be done with other utilities and from the command-line.

Beyond that you’re probably stuck with reinstalling your system. If you do then consider doing a clean install.

-Chris

Thanks for the suggestions.

I got things unstuck by clicking the Revert button in the Services part of the Keyboard pane. (I am pretty sure that was the first time I ever clicked a Revert button.:astonished:) Then I unchecked everything, removed all the shortcuts, and very selectively added back what I needed, including Folder Actions Setup. I was then able to access Folder Actions Setup from the Services menu. No wonder I was confused.

Hey Mitchell,

Glad that worked for you.

-Chris