I'm trying out WatchService with Java 7, to monitor a folder. I want it to monitor any files or folders being added to the path registered with the WatchService.
If I add a folder to the registered path it detects it correctly as ENTRY_CREATE and returns the name of the folder in watchEvent.context(). But if I add a folder to that folder than again it is detected but watchEvent.context() returns the same folder and ENTRY_MODIFY, because that folder has been modified by adding another folder.
So I understand this but don't know if I should be registering every folder within the structure and or just registering the top folder and listening or CREATE and MODIFY