Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>You can use <a href="http://en.wikipedia.org/wiki/Launchd" rel="noreferrer">launchd</a> for that purpose. Launchd can be configured to automatically launch a program when a file path is modified.</p> <p>For example the following launchd config plist will launch the program <code>/usr/bin/logger</code> when the desktop folder of my user account is modified:</p> <pre><code>&lt;?xml version="1.0" encoding="UTF-8"?&gt; &lt;!DOCTYPE plist PUBLIC "-//Apple Computer//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"&gt; &lt;plist version="1.0"&gt; &lt;dict&gt; &lt;key&gt;Label&lt;/key&gt; &lt;string&gt;logger&lt;/string&gt; &lt;key&gt;ProgramArguments&lt;/key&gt; &lt;array&gt; &lt;string&gt;/usr/bin/logger&lt;/string&gt; &lt;string&gt;path modified&lt;/string&gt; &lt;/array&gt; &lt;key&gt;WatchPaths&lt;/key&gt; &lt;array&gt; &lt;string&gt;/Users/sakra/Desktop/&lt;/string&gt; &lt;/array&gt; &lt;/dict&gt; &lt;/plist&gt; </code></pre> <p>To activate the config plist save it to the LaunchAgents folder in your Library folder as "logger.plist".</p> <p>From the shell you can then use the command <code>launchctl</code> to activate the logger.plist by running:</p> <pre><code>$ launchctl load ~/Library/LaunchAgents/logger.plist </code></pre> <p>The desktop folder is now being monitored. Every time it is changed you should see an output in the system.log (use Console.app). To deactivate the logger.plist, run:</p> <pre><code>$ launchctl unload ~/Library/LaunchAgents/logger.plist </code></pre> <p>The configuration file above uses the <code>WatchPaths</code> option. Alternatively you can also use the <code>QueueDirectories</code> option. See the <a href="http://developer.apple.com/library/mac/documentation/Darwin/Reference/ManPages/man8/launchd.8.html" rel="noreferrer">launchd</a> man page for more information.</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload