Comments (8)
Hey @emcrisostomo, could you elaborate on how to use the event filters?
I tried
fswatch --event=CLOSE_WRITE files
which I expected to fire only on CLOSE_WRITE events.
Is that the intended behaviour? Unfortunately I could not find any information in the manuals except for:
--event name
Filter event with the specified name. This option can be used multiple times, one for each event name that must be included in the output.
Unfortunately, on my linux machine this just immediately exits.
from fswatch.
Like the others have said, I think this feature would be extremely useful.
Most of the time we are only interested in actual file changes (CREATE
, CLOSE_WRITE
, DELETE
, MODIFY
, MOVED_FROM
, MOVED_TO
) and we would like to ignore read events (OPEN
, ISDIR
, CLOSE_NOWRITE
, etc.).
I realize that it may not be trivial to implement this in a platform-independent manner, because the events probably differ from one platform to another.
A compromise solution could be to just add a way to filter read events from write events.
Thank you for all the hard work!
from fswatch.
I would definitely like this as well. For example, I only want newly created files to appear in the output.
from fswatch.
Hi @grosch, I expect this issue to be closed quite soon. I'll post updates here.
from fswatch.
I'd like to second this, I'm writing a script to move newly-created files that are dropped remotely into a folder, but on Linux each file creation results in 4 events (only one of which is creation) - and it can also results in an event on the parent folder. So it's much harder to isolate just the created file
from fswatch.
Hi @lucianp,
you're welcome and thanks, it's appreciated.
Yes, I agree it would be useful. In fact, I'm reviewing the mappings between platform-specific events and "generic" fswatch events soon and implement this.
from fswatch.
Hi all,
This issue has been fixed in 1.5.0. I'll prepare the OS X ports shortly.
from fswatch.
@fanktom hello from the future.
Leaving this here incase anyone else is having issues using the event filters. I wasn't able to find the event names anywhere on github or the man
page.
After looking at the source I found the event names here in the event.cpp
I was able to use the event filters like so:
fswatch --event "Updated" .
For an even more specific example I used the filters combined with the -i
flag to only watch for .scss
files being Updated
like so:
fswatch --event "Updated" -e ".*" -i "\\.scss$" .
from fswatch.
Related Issues (20)
- broken exclude on macos? HOT 1
- Configuration header leaked into public interface in v. 1.17.0 HOT 8
- How to get the PDF documentation HOT 3
- Universal (Arm + x86) library build for MacOS on M1 HOT 1
- Ask for help HOT 1
- import error in silicon mac
- Additional waiting period after --one-event
- Make fails on Solaris 11.4 cbe with gcc-10 or gcc-11
- Trailing slash for directories HOT 1
- CMake package config file is not installed
- fswatch fails to build on windows 11 using cygwin
- Installation for windows missing
- libfswatch README copyright looks stale
- Help configuring fswatch to act only on full file being written by SFTP clients HOT 1
- fswatch command fires multiple events for a single move operation HOT 4
- Which event type should I look for if I am watching a Google Drive directory for new files?
- NetBSD support
- Is there any way to get previous filename for Rename event?
- Symlink question: Is fswatch suppose to notify of linked file changes HOT 1
- execute cmd for single filetype
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from fswatch.