Check out this article:
Enter "man inotify" at the Linux command line:
- inotify - monitoring file system events
- The inotify API provides a mechanism for monitoring file system events. Inotify can be used to monitor individual files, or to monitor directories. When a directory is monitored, inotify will return events for the directory itself, and for files inside the directory.
And this article: