Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

For the past two days i've been trying to get a launchd plist to execute a script "program" when the contents of a folder on my desktop contents have modified or changed. I've gone through tons of configuration settings and have tried the Users/me/Desktop/folderinquestion and Users/me/Desktop/folderinquestion (with and without trailing slash).

The script executes only when something is added or removed but it doesn't recognize when files are updated and subdirectories. launchd is really my last hope to getting this to working i've already exausted folder actions, and bash scripts, uninstallable linux methods etc.

I have used Lingon to create my plists and have followed this youtube tutorial. Any help would be greatly appreciated.

This is what I have right now, and like I said does not work when folder is modified or changed

enter image description here

IDEA:

Thinking about creating two separate plists that reference each other one plist can watch a folder for additions and subtractions and when one occurs it can create another plist that watches every file in the folder, this could also be recursive and count in for subdirectories.

share|improve this question

1 Answer 1

up vote 2 down vote accepted

I don't think launchd supports that level of monitoring; you can watch individual files or you can watch for additions to a directory, but you can't do full inotify/fam/gamin-style watching of an entire directory tree. You would need to run as a standalone daemon and use either BSD kqueue or Mach ports (or use fam or gamin to do it for you) to monitor your tree.

share|improve this answer
    
Since this is OS X, FSEvents seems line the obvious tool for this. Peter Hosey posted some sample code over on stackoverflow. –  Gordon Davisson Jun 26 '11 at 2:37

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.