How to detect filesystem has changed in java

Posted by Alfred on Stack Overflow See other posts from Stack Overflow or by Alfred
Published on 2010-03-15T22:31:15Z Indexed on 2010/03/15 22:39 UTC
Read the original article Hit count: 381

Filed under:
|
|
|

Hi all,

I would like to know how to efficiently implement filesystem changes in java? Say I got a file in a folder and modify that file. I would like to be notified by java about this change as soon as possible(no frequently polling if possible.).

Because I think I could call java.io.file.lastModified every few seconds but I don't like the sound of that solution at all.

alfred@alfred-laptop:~/testje$ java -version
java version "1.6.0_18"
Java(TM) SE Runtime Environment (build 1.6.0_18-b07)
Java HotSpot(TM) Server VM (build 16.0-b13, mixed mode)

Many thanks, Alfred

© Stack Overflow or respective owner

Related posts about java

Related posts about filesystems