Friday, 15 September 2017

macos - Monitor a Folder OSX for file changes then run a bash script




Possible Duplicate:
Watch Filesystem in Real Time on OS X and Ubuntu



I'm looking for a efficient method to monitor a local directory in OSX and if any files have been changed in that directory run a bash script to commit the files to github.


Any recommend tools for monitoring a directory for file changes, then triggering an action, i.e. a bash script?



Answer



Using fswatch from your repository:


fswatch . 'git commit -avm "snapshot at ${date}"'

This simple example would only catch changes to files already in the repository.


No comments:

Post a Comment

Where does Skype save my contact's avatars in Linux?

I'm using Skype on Linux. Where can I find images cached by skype of my contact's avatars? Answer I wanted to get those Skype avat...