2

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?

clneagu
  • 43
  • 5

1 Answers1

4

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:

#!/bin/bash

if ! grep -q $1 /path/to/incron.excludes
then
    exec /path/to/realscript.sh $1
fi
Cakemox
  • 24,141
  • 6
  • 41
  • 67
  • Thank you. I also received an interesting answer on stackoverflow: http://stackoverflow.com/questions/6383021/how-can-i-exclude-pattern-from-inotify-incron – clneagu Jul 06 '11 at 08:43