javaunixfile-monitoring

Monitor file/folders to get change notifications in UNIX


The requirement is to monitor multiple folders and file for any changes in UNIX. I need to be able to hook my java code for any changes like create/modify/delete. Could anybody suggest any java based frameworks to do the same?


Solution

  • If you use Java 7, you can use the WatchService API to monitor changes to the file system.

    If you are stuck with Java 6-, you can have a look at some alternatives proposed in this post or this other one.