Is there a simple way to automatically run a (Terminal) command every time a file is changed in a specific folder?
This should be possible via the command line, or a system built-in application, no third-party applications.
Any ideas?
|
Is there a simple way to automatically run a (Terminal) command every time a file is changed in a specific folder? This should be possible via the command line, or a system built-in application, no third-party applications. Any ideas? |
|||||
|
|
You could use Folder Actions, which lets you execute (Automator) scripts whenever contents in a folder change. As far as I know, Automator has a template that lets you easily create a new folder action and attach it to the desired folder. And by adding a "Run Shell Script" action, you should just get the desired effect. |
|||||
|
|
Save a property list like this as
The agent can be loaded with Tilde expansion ( If a watched file is modified within ten seconds from the last invocation, a message like this is added to system.log:
One way to get rid of the messages is to add something like Changes in subfolders of watched folders aren't detected. See |
||||
|
|
|
Automator has a type of workflow called a "Folder Action" which automatically runs when something is added to a folder. Create one, then use the action "Run Shell Script." |
|||||||
|
|
You might want to try something like this:
|
|||||
|
|