Project

fswatch

0.0
No commit activity in last 3 years
No release in over 3 years
A program for triggering a script on file system change (on OS X)
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies
 Project Readme

fswatch

A trivial Ruby script for triggering a command on file system change in OS X.

Installation

The point was mainly to shove this into gemcutter so it's easy to deploy:

$ gem install fswatch

Usage

On file system change execute ls -l:

$ fswatch ls -l

Watch a specific path:

$ fswatch -d / ls -l

Wait at least 5 seconds before refreshing using deferral:

$ fswatch -t5 ls -l

If the command is long running and you want to forcibly restart it on file system change:

$ fswatch -x ls -l

If you want to pass the paths which have changed as a parameter to the command:

$ fswatch -p echo

If you want to place the paths somewhere other than at the end, use the @fspaths token:

$ fswatch -p "echo @fspaths | wc -l"

You can also use @fspathscolon for colon-separated paths and @fspatchcomma for comma-separated paths.

Examples

Automatically rsync on changes:

$ fswatch -t 5 "rsync -av . devbox:/devfolder-on-devbox/"