Java Directory Listener
In Java 7 you can use java.nio.file package that to listen directory change events. In this example you will see how to create Java directory listener which will listen supported StandardWatchEventKinds event types below:
- ENTRY_CREATE – Directory entry is created
- ENTRY_DELETE – Directory entry is deleted
- ENTRY_MODIFY – Directory entry is modified
- OVERFLOW – Indicates which events might have been lost or discarded. We do not have to register for OVERFLOW event to receive it.
As I have tested in windows environment same can be use in Linux as well only you will have change path of the file.
- For more information please visit Oracle documentation here