Reputation: 26732
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?
Upvotes: 1
Views: 742
Reputation: 1626
The name of the Java 7 feature you'll be interested in (when it is properly available) is the WatchService.
Upvotes: 2
Reputation: 45324
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).
Upvotes: 2
Reputation: 6835
I think this can interest You: What is the easiest way to track a change in a folder in Java?
Upvotes: 3