[python-win32] subtree problem with ReadDirectoryChangesW

Mark Hammond mhammond at skippinet.com.au
Sun Jan 14 10:55:55 CET 2007


Check out win32\test\test_win32file - it has a test for that function,
including some comments about using it with threads.

The short version is that you don't sleep - just call
ReadDirectoryChangesW - it will return when a change happens.

> The result is that the api works good only if the changes in
> in top-level and second-level, else I got a () only.
>
> I search for msdn and found that there is a parameter 'BOOL
> bWatchSubtree' in the original api, where is it in pywin32?

Check out the help file installed with pywin32 - it documents that as the
3rd param.

> What can I do now ? Maybe only I can do is to create a
> watcher thread for each directory in d:\\

I've successfully used this function to watch a sub-tree in the past,
although not from the root.  I'd expect that to be expensive!

Mark



More information about the Python-win32 mailing list