Reputation: 139
I've been using JCIFS to watch an SMB directory for changes by polling the directory timestamp. However, that timestamp isn't always updated when the directory CONTENTS are updated (e.g. a file gets a new timestamp).
I note that the JCIFS SmbFile has a watch() method. Is there an example of how to use this?
The alternative for me would be to monitor each individual file in the directory for updates. But I fear the overhead, with a large number of files on a slow network, would be considerable.
Upvotes: 1
Views: 177
Reputation: 101
The code is available on github for examination.
Briefly: SmbFile.watch() returns a watch handle.
The watch handle has a method (also called watch()) that allows you to block until there are changes, at which point it returns a list of changes.
Upvotes: 0