Skip to main content

I need to a way to attach a folder action script that I created to every users download folder. I know where the action scripts are stored, so I know how to get that into the right place. I just cant seem to figure out how to enable the action script through a deployment or using a terminal command.



Anyone have any ideas?

I'd use a LaunchAgent and WatchFolder. Haven't tested this, but it should work....



But to test, put the file below in /Library/LaunchAgents/com.company.mygreatTool.plist and a script to to whatever in place of script.sh below. Every time the download folder gets touched, the script will run.



<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>com.company.mygreatTool</string>
<key>EnableGlobbing</key>
<true/>
<key>ProgramArguments</key>
<array>
<string>/Library/path/to/script.sh</string>
</array>
<key>WatchPaths</key>
<array>
<string>~/Downloads/</string>
</array>
<key>OnDemand</key>
<true/>
</dict>
</plist>

Does launchd recognize ~ ?


It does path expansion with the <key>EnableGlobbing</key> key.


Man I could kiss you right now! This just saved my life! Thanks buddy!


Reply