How to know a file is finished copying

前端 未结 3 653
小鲜肉
小鲜肉 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 07:54

    Windows provides an API to monitor directory content update. You can use the Created event to detect new file, but be aware that this event firing does not necessarily means that the file is released yet.

    native C++ specs and code example :

    http://msdn.microsoft.com/en-us/library/aa365261(VS.85).aspx

    .net :

    http://msdn.microsoft.com/en-us/library/system.io.filesystemwatcher.aspx

提交回复
热议问题