Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm using incron to watch for events in a directory but I want to exclude some subdirectory or some filename PATTERNS.

Is there a way I can do this elegantly?

share|improve this question
up vote 1 down vote accepted

You can't do exclusions through incrontab. You can list the files explicitly, or you can make a wrapper to filter files which you do not want to process.

A super-simple wrapper:


if ! grep -q $1 /path/to/incron.excludes
    exec /path/to/ $1
share|improve this answer
Thank you. I also received an interesting answer on stackoverflow:… – clneagu Jul 6 '11 at 8:43

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.