Hello, I have recently written a tool that heavily depends on win32file.ReadDirectoryChangesW.
Firstly, It fires potentially hundreds of notifications for a simple save operation. And for a windows copy operation it fires virtually no resaults untill near the end of the copy. Point being it was very hard for me to determine when actual write operations had finished due to all these sporadic events. 1. My first Dilema was trying to work out a way to consider all these events as just 1 event. Is there a flag for this? I ended up writing some special filters to filter out all the extra events that follow an initial event up untill some condition is met. but I'm wondering if there is an easy way to determine when a write operation has actually finished? or when a write operation first STARTS. Nothing more. 2. Secondly and more importantly. Events go missing. Sometimes i get a 'file deleted' event followed by a 'file created' event when i save a file, but sometimes i just get a 'file created' event with no 'file deleted' event preceding it. Both times i saved the file in exactly the same way. And it appears to be very random when it chooses to skip out on not reporting the 'file deleted' event. Any ideas as to why some events appear to go missing? Is "ReadDirectoryChangesW " prone to inaccuracy's. I have tried having rather large heap sizes and that does not appear to help. If ReadDirectoryChanges is solid acoording to you guys then i will just have to keep trawling through my code to see if its something else. Here are some snippets from it to show you how i have set up the directory watching parameters. hDir = win32file.CreateFile ( path_to_watch, FILE_LIST_DIRECTORY, win32con.FILE_SHARE_READ | win32con.FILE_SHARE_WRITE, None, win32con.OPEN_EXISTING, win32con.FILE_FLAG_BACKUP_SEMANTICS, None ) results = win32file.ReadDirectoryChangesW ( hDir, 10000, #Heap Size include_subdirectories, win32con.FILE_NOTIFY_CHANGE_FILE_NAME| #should return an integer of 1 win32con.FILE_NOTIFY_CHANGE_LAST_WRITE, #should return an integer of 3 None, None ) note: there are some loops that run that constantly return the resaults of ReadDirectoryChangesW. i based my code off tim goldens multithreaded directory watcher demo found at. (not much difference) http://tgolden.sc.sabren.com/python/downloads/watch_directory.py Im going to have an awesome tool once this is done that i hope to share. Thanks for any insights. Mark _______________________________________________ Python-win32 mailing list Python-win32@python.org http://mail.python.org/mailman/listinfo/python-win32