You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Can't get folder action to work

I just upgraded from 10.8 to 10.11. On my 10.8 system I had various workflows that each monitored the same folder and moved files to appropriate subfiles based on the kind of file they were (based on their extensions). I can't get these to work now. I write a lot of AppleScripts, and work with other kinds of automation, but haven't done much with Automator. I've read lots of articles on the web, but I'm not convinced that what they are saying isn't just too old to be applicable to El Capitan. In any case, their instructions don't seem to work for me.


First of all, I am confused about where these scripts go. If they are in ~/Library/Scrpts/Folder Action Scripts, I can use the AppleScript icon on the menubar to attach the workflow to a specific folder. However, if i open the workflow in Automator, as it opens I am asked whether I want to install the workflow, in which case it moves the workflow to ~/Library/Workflows/Applications/Folder Actions.


Then, I can step through these simple scripts, and everything looks OK, but the files don't get moved. Here is an example, which has to be just about the simplest file-processing script possible.


I am also confused about why I am receiving files from a specific folder — how my old scripts worked: cisn't there a way to generalize this so I can install the same workflow on more than one folder?


I've read lots


I feel really dumb. Save me, please! Maybe answers will help other people looking to make Automator scripts work.


User uploaded file

MacBook Pro, OS X El Capitan (10.11.4), Hi-Res anti-glare wide screen

Posted on May 9, 2016 7:58 PM

Reply
9 replies
Sort By: 

May 9, 2016 8:11 PM in response to MLModel

Automator and AppleScript store their folder action workflows and scripts in those different locations. Make sure folder actions are enabled and that the workflow or script is attached to the folder - you can right-click on a folder and select Services > Folder Actions Setup from the contextual menu. Something else you can check is whether the Filter Folder Items action is actually returning items - the find and filter actions use Spotlight, so if the items have not been indexed your workflow may not be getting anything to work with.

Reply

May 10, 2016 2:35 AM in response to MLModel

Hello


You may create your folder action in plain applescript without resorting to automator.


Here's a sample script. To use it, specify real paths in d_png, d_jpg and save the script in ~/Library/Scripts/Folder Action Scripts.



property d_png : "/path/to/destination/for/png" as POSIX file as alias property d_jpg : "/path/to/destination/for/jpg" as POSIX file as alias on adding folder items to da after receiving aa open aa end adding folder items to on open aa repeat with a in aa set f to "" & a if f ends with ".png" then set d to d_png else if f ends with ".jpg" or f ends with ".jpeg" then set d to d_jpg else set d to "" end if if d is not "" then tell application "Finder" to move a to d end repeat end open




Good luck,

H

Reply

May 10, 2016 3:07 PM in response to balsa2

I am not getting anywhere at all. Has anyone verified that Folder Actions actually work in El Capitan? Here's an even simpler one than I posted. (The first step isn't intended to do anything, it's just there in case for some weird reason something like it is required.) It works when run from within Automator (of course), even if I ignore the initial dialogue saying I need to add a Get Specified Finder Items step. Yes, I have enabled Folder Actions from the scripts menu.


All of the online articles I could find appear to be pre 10.10.


User uploaded file

Reply

Oct 10, 2016 8:12 PM in response to MLModel

I was having this problem, today, until I ran the "Enable Folder Actions" script in the applescript menu. It runs this, as the entire script:


<script>

tell application "System Events" to set folder actions enabled to true

</script>


the gui enabling checkboxes weren't working for me, but this did.

Reply

Dec 13, 2016 10:30 PM in response to MLModel

Hi All,


I see that this is an older thread, but since I just solved this issue on my new macOS Sierra setup, in a different way than those already posted, I thought I'd share what I discovered, and what worked in my case.


My goal was to get a known good Automator workflow folder action for my Downloads folder in El Capitan working on the equivalent folder in a clean macOS Sierra install.


When I opened the workflow in Sierra, Automator offered to 'install' the folder action workflow, which amounted to moving it to ~/Library/Workflows/Applications/Folder Actions. At the top of the open workflow, it still said 'Folder action receives files and folders added to > Downloads,' and hovering mouse pointer over Downloads confirmed correct path. Dropping a file into Downloads folder at this point didn't trigger the workflow.


Control clicking on Downloads folder in Finder, and then choosing Services > Folder Actions Setup from contextual menu, opened the Folder Actions Setup app. The Enable Folder Actions checkbox was not checked off, so I clicked to enable it. In the left pane labeled Folders with Actions, I saw my Downloads folder, and it was selected and enabled. In the right pane labeled Script, I saw nothing. Dropping a file into Downloads folder at this point still didn't trigger the workflow.


Returning to Folder Actions Setup app, I deleted Downloads folder from list of Folders with Actions, and then added it back. When I added it back, I was prompted to choose a workflow or script to attach to that folder. After selecting my preferred workflow, I now saw my Downloads folder in the left pane, and my desired workflow for it in the right pane (which was different than before). Dropping a file into Downloads folder at this point triggered the workflow, which ran successfully.


Not sure why it took so many non-obvious steps to get this working, but glad that it's working now.


Good luck to others with similar issues!


Eric

Reply

Can't get folder action to work

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.