gorakhargosh / watchdog

Python library and shell utilities to monitor filesystem events.
http://packages.python.org/watchdog/
Apache License 2.0
6.49k stars 695 forks source link

Problem with Recursive #386

Open iTommix opened 7 years ago

iTommix commented 7 years ago

Hi.

I try to use watchdog for syncing my home-folder and its content to a server like folder redirection for windows machines in a domain.

If i specify a subfolder in my home directory (e.g. Desktop) everything works. but if i specify "/Users/thomas" watchdog wont recognize changes anywere in there.

Running on OS X 10.10.5

Kind Regards Thomas

DonyorM commented 7 years ago

Take a look at the front page, particularly this line:

observer.schedule(event_handler, path, recursive=True)

Be sure to pass the recursive=True parameter to your schedule method.

iTommix commented 7 years ago

Thanks for Reply... but my code include this "recursive=True", it doesnt work.

DonyorM commented 7 years ago

Could you post your exact code, so I can see if I can reproduce it?

petersilva commented 7 years ago

is /Users/thomas a symbolic link (itself?) you can try /Users/thomas/. as one work around, or os.realpath(/Users/thomas) might also work.

This might be the same as issue 339: watchdog doesn't like symlinked directories at all.

petersilva commented 7 years ago

sorry: #365, not 339.

petersilva commented 7 years ago

The implementation seems to expect and enforce that symlinks are never followed. I expect that most of the time, following sym-links is what people expect, and if we don't get a choice, then please always follow. One could, of course, introduce an option.

oh and #353 is also the same bug... so I got the source, and found this suspicious thing:

I implemented a fix for Linux... fwiw... https://github.com/petersilva/watchdog

and sent a pull request.

Someone else will have to fix Mac & windows.