2

Users sometimes add files to a directory on a linux server. I was looking at ways to be informed when a file has been added to this directory. I found inotify-tools:

https://github.com/rvoicilas/inotify-tools/wiki/

But I am not too sure how to go about using it. I can't seem to find a proper documentation on it.

I would appreciate it if anyone with experience in it could guide me.

HyderA
  • 20,651
  • 42
  • 112
  • 180

2 Answers2

2

With inotifywait you can do what you want, check the manual page.

0

Try using entr, e.g.

while true; do find path/ | entr -d echo Changed | mail foo@example.com; done

or:

while true; do ls path/* | entr -pd echo Changed | mail foo@example.com; done
kenorb
  • 155,785
  • 88
  • 678
  • 743