Reputation: 9375
I'm trying to index a file structure (not actual data) relative to a specific path on my local disk. Initially I load the file structure to memory then listen for real changes in the directory. If one occurs then I update the relevant indexed files in internal memory. Not unlike what dropbox seems to do?
Does there exist any java-library which can do this? I don't really want to implement this from scratch.
Upvotes: 0
Views: 435
Reputation: 10094
To listen for changes on a file, you can have a look at apache commons io which has a FileAlterationMonitor.
Upvotes: 3
Reputation: 274612
Java 7, as part of NIO.2, has the WatchService API.
The WatchService API is designed for applications that need to be notified about file change events.
Upvotes: 2