Here is the problem: I monitor a directory using Win32 API ReadDirectoryChangesW function. And I need to distinguish between newly created files and modified files. But there are problems... as always :(
Cases:
- I monitor directory for new/modify (
FILE_NOTIFY_CHANGE_FILE_NAME | FILE_NOTIFY_CHANGE_SIZE
). Problem: After file creation, new file event + modify file event is triggered. But i need only one. How can I avoid that? When file is modified I get what I want :). - I monitor directory only for new file (
FILE_NOTIFY_CHANGE_FILE_NAME
) - NO PROBLEM. - I monitor directory only for modify file (
FILE_NOTIFY_CHANGE_SIZE
). Problem: When a new file is, modify action is fired along with file creation event. How can I avoid that?
Of course, I implemented some workarounds. But, I want to know if there any elegant way of handling the problems I described.
Thanks in advance!