I am using JDK 7 WatchService to browse directories.
The event ENTRY_DELETEtells me that the record has been deleted. I can get the name of this entry, something similar to:
WatchEvent<Path> ev = cast(event);
Path name = ev.context();
Path child = dir.resolve(name);
I want to know if the remote record was a file or folder. Naturally, I tried child.isDirectory(), but it did not work, of course, because the element no longer exists.
Is there a way, without heuristic, to indicate if the deleted item was a file or directory?
source
share