Code Monkey home page Code Monkey logo

Comments (8)

fanktom avatar fanktom commented on June 12, 2024 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.

lucianp avatar lucianp commented on June 12, 2024 2

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.

grosch avatar grosch commented on June 12, 2024

I would definitely like this as well. For example, I only want newly created files to appear in the output.

from fswatch.

emcrisostomo avatar emcrisostomo commented on June 12, 2024

Hi @grosch, I expect this issue to be closed quite soon. I'll post updates here.

from fswatch.

RomeshA avatar RomeshA commented on June 12, 2024

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.

emcrisostomo avatar emcrisostomo commented on June 12, 2024

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.

emcrisostomo avatar emcrisostomo commented on June 12, 2024

Hi all,

This issue has been fixed in 1.5.0. I'll prepare the OS X ports shortly.

from fswatch.

zachatrocity avatar zachatrocity commented on June 12, 2024

@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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.