I am using JDK 7's WatchService to monitor directories.
The ENTRY_DELETE
event tells me an entry has been deleted. I can get the name of that entry doing something similar to:
WatchEvent<Path> ev = cast(event);
Path name = ev.context();
Path child = dir.resolve(name);
I want to know if the deleted entry was a file or folder. Naturally, I tried child.isDirectory()
but that didn't work, of course, because the element doesn't exist anymore.
Is there any way, without heuristics, telling if the deleted element was a file or a directory?
Thanks.