Questions tagged [fswatch]

A cross-platform file change monitor with multiple backends: Apple OS X File System Events API, *BSD kqueue, Linux inotify and a stat-based backend.

A cross-platform file change monitor with multiple backends: Apple OS X File System Events API, *BSD kqueue, Linux inotify and a stat-based backend.

http://emcrisostomo.github.io/fswatch/

54 questions
21
votes
2 answers

How to use fswatch and rsync to automatically sync directories?

I'd like to automatically run a one way sync between two local directories using rsync. Meaning when a change is detected in a file of /dir1 or its subdirs, the following command should run: rsync -rtuv /dir1 /dir2 How can I go about achieving this…
OpherV
  • 6,787
  • 6
  • 36
  • 55
21
votes
2 answers

How to run fswatch to call a program with static arguments?

I used to use fswatch v0.0.2 like so (in this instance to run django test suit when a file changed) $>fswatch . 'python manage.py test' this works fine. I wanted to exclude some files that were causing the test to run more than once per save…
Guy Bowden
  • 4,997
  • 5
  • 38
  • 58
20
votes
2 answers

fswatch to watch only a certain file extension

I am using fswatch and only want it triggered if a file with extension .xxx is modified/created etc. The documentation and the second reference below indicate that: All paths are accepted by default, unless an exclusion filter says…
Peter Grill
  • 548
  • 7
  • 23
12
votes
2 answers

How to watch file changes on Mac OSX using FSWatch?

I'm trying to use fswatch to translate the following lines from a linux bash script to be able to run it on Mac OSX: inotifywait -r -m 'myfolder/' | while read MODFILE do echo "something" done Since inotifywait doesn't work on Mac OSX I want to…
kramer65
  • 50,427
  • 120
  • 308
  • 488
5
votes
2 answers

How do I programmatically delete cookies in Safari 8.0 on OS X 10.10 (Yosemite)

In Safari 8.0 (10600.1.25.1) on OS X 10.10.1 (Yosemite), I visit some sites like google.com, apple.com, facebook.com and can then see the cookies when I click "Safari" -> "Preferences..." -> "Privacy" -> "Details..." I then quit Safari completely…
AaronJ
  • 1,060
  • 10
  • 24
5
votes
2 answers

Real-time git diff

I typically like to type up my git commit messages while looking at the git diff. I very much enjoy the output produced by this little perl add-on to git, and produces output that looks like this from git diff (this is a screenshot of git log -p…
Steven Lu
  • 41,389
  • 58
  • 210
  • 364
4
votes
1 answer

Accepting name of changed file in fswatch with xargs in osx

In osx I am trying to detect when a new file is added to a folder, then execute a script to process that new file. Seems simple, right? I am doing this: fswatch -0 ~/motion-detection | xargs -0 -n1 -I {} ./detectmotion.sh which will call the…
Uberbug
  • 97
  • 9
4
votes
1 answer

When i fswatch a particular folder in mac , i get renamed is file for both addition and deletion of files in folder

I am monitoring a particular folder in mac os by giving in commandline fswatch -x /Users/syammala/folder /Users/syammala/folder/posixGroup.xml Renamed IsFile Whenever i add or delete a file i always get renamed is file. I want to differentiate…
MacDeveloper
  • 1,334
  • 3
  • 16
  • 49
3
votes
2 answers

Output redirection of real-time stdout doesn't work after piping it into uniq or awk

I'm trying to run fswatch -tr /home/*/*/public_html | grep --line-buffered -E ".php|.xml" | awk '!seen[$0]++' >> log.txt or equivalently (by using uniq): stdbuf -i0 -o0 -e0 fswatch -tr /home/*/*/public_html | grep --line-buffered -E ".php|.xml" |…
3
votes
1 answer

Is there a way to watch a .git folder, and update my git log whenever it changes?

I have been trying to create an automatically updating git log --graph --no-pager. I made some strides using fswatch but I ran into the issue of my git history being actually bigger than my screen can display. I tried adding | head -n $((`tput…
Felipe Rocha
  • 127
  • 8
3
votes
3 answers

I want to watch multiple folders with fswatch on Mac

I see in the documents for fswatch it has $ fswatch -0 [opts] [paths] | xargs -0 -n 1 -I {} [command] but I don't really understand how I'm supposed to add multiple paths to that - I'm watching two paths lib and test. I've tried: fswatch -r…
Jono
  • 3,393
  • 6
  • 33
  • 48
3
votes
4 answers

Regex with fswatch - Exclude files not ending with ".txt"

For a list of files, I'd like to match the ones not ending with .txt. I am currently using this expression: .*(txt$)|(html\.txt$) This expression will match everything ending in .txt, but I'd like it to do the opposite. Should…
stephane
  • 33
  • 1
  • 4
2
votes
0 answers

limiting number of time fswatch runs

I have a fswatch set up on a directory which triggers a script to refresh my browser every time a file is changed. It works but if there is a bunch of files added or deleted in a single shot, the browser can refresh for very long periods of time…
StevieD
  • 6,925
  • 2
  • 25
  • 45
2
votes
0 answers

port exclude pattern from inotifywait to fswatch

So I have this regex exclude pattern which works excellent with inotifywait on Linux: .*\.\w+\.\w{6} Now I want to port it to fswatch on macos and use with -e or -Ee flag. What have I tried so far without any luck: -e ".*\.\w+\.\w{6}" -Ee…
valignatev
  • 6,020
  • 8
  • 37
  • 61
2
votes
1 answer

NodeJs fs.watch/FSWatcher Error

Hello I Use the following, Ubuntu 17.04 Node: v6.11.2 NPM: v3.10.10 While installing My project dependencies I get warning on installing fsevents(this error. I ignored that and I ran the project using Gulp. I get the following error, events.js:160 …
Sriram
  • 21
  • 3
1
2 3 4