How to know a file is finished copying

前端 未结 3 621
小鲜肉
小鲜肉 2021-01-22 07:28

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 writ

3条回答
  •  广开言路
    2021-01-22 08:06

    When you poll for the size of the file, don't use _stat/_stat64. Instead, open the file each time you need and call _filelengthi64 to get the size of the file. The file size that is returned by _stat64 is not updated in real-time by the Windows operating system. Also by being able to open the file, you are testing to see that any long copy operations have been completed.

提交回复
热议问题