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
2
votes
2 answers

fswatch with grep not piping

I want to use fswatch to run a file through my unit test framework whenever I save. As a test, I run fswatch and make a minor change to /my/path/test.txt in my text editor and get the output I expected: $ fswatch . | xargs -I {} echo {}…
Jesse Aldridge
  • 7,991
  • 9
  • 48
  • 75
2
votes
0 answers

Use fswatch with imgcat

I am trying to automatically display an image in the terminal whenever a file is updated or added to a directory. I can manually do this with imgcat in iTerm2, and I can get fswatch to report correctly when a file is changed. But I can't get them to…
drstevok
  • 715
  • 1
  • 6
  • 15
2
votes
0 answers

Writing files in the background process

I am trying to create a script that will process modified/new files in a directory (which is being mirrored from a remote directory by lftp but that's another story). To keep track of the files that are modified I use fswatch. I then convert the…
econ
  • 547
  • 7
  • 22
2
votes
1 answer

Any script to notify when there is no write activity in folder

I am trying to come up with a nice and easy way of detecting when there has not been any write activity in a folder I'd like to watch. Basically, what I'd like to have is something like this: #!/bin/sh # colored red text (error) function errorMsg…
Michahell
  • 4,905
  • 5
  • 29
  • 45
2
votes
1 answer

fswatch + rsync alternative or better inplementation

I'm trying to watch a folder, and its subfolders for any changes in the files (HTML/CSS/JS/Etc). Once a file has changed, I want to upload it to a mounted drive from a remote server. Currently, I am using this in terminal: fswatch -o ~/Desktop/Site/…
ksumarine
  • 782
  • 2
  • 12
  • 33
2
votes
0 answers

Trigger rsync with fswatch in one line

I'm trying to trigger rsync with fswatch, but don't know how I can do it in one line or at least in one script. I'm testing this with two folders test and test_bak in my Documents folder. The date.log is just for debugging and should be replace with…
reitermarkus
  • 678
  • 1
  • 11
  • 27
1
vote
0 answers

How to run the node.js script again if there is change in a folder?

I have created a Node.js script which pick up some images from a directory and do the work and after doing all the process it moves the image to another folder and my script ends but did not exist, so when I add new images in the folder, I need to…
1
vote
1 answer

Output filename extension in fswatch and ffmpeg

I'm having issue with the file-naming extension output. My input is JPG files that needs to convert to MP4 using FFMPEG. However, when I run the code below it output as img1.jpg.mp4 including the input file extension instead of just…
rr09
  • 11
  • 3
1
vote
1 answer

How to track order of newly created files in directory with fswatch

I need to monitor a downloads directory, and keep track of the order in which files were written to the directory. The only way I know this is possible in macos is fswatch, but the documentation seems quite sparse compared to inotifywatch on linux.…
Hans J
  • 35
  • 6
1
vote
1 answer

Changing the permissions and owner of the /var/www/html folder using fswatch and xargs

I want to change the owner and permission of the /var/www/html folder every time I add/create or update any new file or directory in this folder. I thought of using fswatch for this to grab the events that happen in that directory(i.e…
Tejas Shah
  • 55
  • 9
1
vote
1 answer

Bash: run command on file change and on standard input

I have a nice file watcher using fswatch: cmd="go install ./..." $cmd fswatch -0 ./ | while read -d "" event; do echo "File Changed: $event" $cmd done Now I also want to listen for input at the command-line, so if I type in anything, $cmd will…
1
vote
1 answer

Bash Script - fswatch trigger bash function

I have a bash script where I want to trigger a method every time the filesystem is changed: #!/bin/bash function run { echo Do some magic // Do some magic } run fswatch . src | 'run' In this case I am watching the src folder. When I…
Creative crypter
  • 1,348
  • 6
  • 30
  • 67
1
vote
2 answers

rsync, directory containing 3 million files, can it keep up?

I am working on a mac computer using bash commands via terminal. I am running a DNA sequencer that generates ~3-5 million files over the course of 48 hours. For speed reasons these files are saved to the computer's SSD. I would like to use fswatch…
Paul
  • 656
  • 1
  • 8
  • 23
1
vote
2 answers

fswatch-ing a list of files, make-ing only the changed ones

Here's a minimal makefile for using pandoc to compile md to pdf. The make watch command watches for changed md files (using fswatch) and triggers make if so. SRCS=$(wildcard *.md) PDFS=$(SRCS:.md=.pdf) all: $(PDFS) %.pdf: %.md @pandoc $< -o…
SEC
  • 799
  • 4
  • 16
1
vote
1 answer

Stop watching a folder for changes if a file exists (bash)

I'm using fswatch to keep track of changes to a directory, but would like this process to stop if a certain file exists (with a wildcard). This certain file is created in an alternative directory (not in the tracked directory) by another process…
econ
  • 547
  • 7
  • 22