Monitoring a directory for changes with Linux is possible through the well-known mechanism inotify. With inotify it’s possible to set a watch on a directory, configure it to watch events on the contents, and you’ll receive messages on a file descriptor when something happens. This works perfectly when the directory is on local storage, like a hard drive, SSD or a USB drive, But it is not sufficient when the directory is on a network filesystem when the storage is on another computer. Another user working in the same directory, connected via the same or another filesystem, can remove a file and the watch you’ve set on it will not get notified.
Read the original at Howtoforge Linux Howtos und Tutorials.