Is there a good way to detect deletes in Java? I know I can loop through the contents of a folder and compare the previous results, but is there a better event driven way?
+3
A:
I think this can interest You: http://stackoverflow.com/questions/1031931/what-is-the-easiest-way-to-track-a-change-in-a-folder-in-java
Maciek Sawicki
2009-11-05 19:07:19
Specifically look here: http://java.sun.com/developer/technicalArticles/javase/nio/#6 but bear in mind this is Java 7 functionality.
Jherico
2009-11-05 19:08:43
+2
A:
There's no pure-java way to do what you describe. Here's a project that uses the JNI to do filesystem monitoring on Windows and Lniux, but I don't endorse it (I merely found it through google).
Jonathan Feinberg
2009-11-05 19:08:52
+1
A:
The name of the Java 7 feature you'll be interested in (when it is properly available) is the WatchService.
Xanatos
2009-11-06 03:22:11