It seems that inotifywait works with exclude lists only.

I have seen the workarounds, but don't like them:

How to use inotifywait to watch a directory for creation of files of a specific extension

Is there a tool which allows listening for *.json files only (without workarounds)?

I want to call a tool (without wrapping it in a script). The work-around of above question needs a loop. I would like to avoid this, if possible.

Update: Since there seems to be no tool which can do this out-of-the-box I wrote a simple Python script and used the lib pyinotify

  • 1
    You will not find anything better than inotify with custom treatment to only considers the files you have interest in. Also file extension are not consider to identify files in Linux. They only exists to help readability for human. – Kiwy Sep 12 '18 at 14:23
  • @Kiwy I am searching an alternative to inotifywait. I search for a different tool. And of course this will use inotify. I am not searching an alternative to inotify. – guettli Sep 12 '18 at 14:34
  • 1
    I recommand the python library inotify. it works quiet well and I'm sure it could handle filtering – Kiwy Sep 12 '18 at 14:40
  • 1
    In the link you posted for workarounds I think it's clear that the accepted answer is awful, but the other answer seems straightforward. What is it about that answer that you don't like? That might affect an answer here. – Tony Sep 20 '18 at 23:28
  • 2
    Umm, that git repo has an --include and --includei option, but it's not in the binary I have. Confused now?! – ams Sep 21 '18 at 22:36

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.