How to know a file is finished copying

Posted by Yigang Wu on Stack Overflow See other posts from Stack Overflow or by Yigang Wu
Published on 2009-02-18T02:46:45Z Indexed on 2010/03/20 21:01 UTC
Read the original article Hit count: 451

I’m using ReadDirectoryChangesW to spy a folder, if I’m copying a large file to the folder, I can receive multiple FILE_ACTION_MODIFIED messages, it seems each time windows writes a large chunk of the file, you get the file modified notification for each time. I tried to use CreateFile API to check if the file can open by AP or not, but sometime, some of files are always locked by other AP, for example, if you are opening the Outlook, the PST will update, but my AP can’t access it, we have to start Shadow Copy to open it. So my question is, how to know a file is finished copying?

© Stack Overflow or respective owner

Related posts about winapi

Related posts about file-copying