开发者

File.Copy() sync or asycn?

I am using File.Copy(source, dest, true) to copy a file from local to remote with overwrite option. In my case, the dest is a mapped network drive:

File.Copy(source, dest, true);
UnMa开发者_C百科pDrive(); // unmap the network drive

The problem I have afterward is that the source file may be locked so that I could not delete the file from local.

I guess that it might be caused by File.Copy() call. Not sure if this one is synced process or not. In other words, is the source file released after the call?


Yes, it is released and the File.Copy method blocks the execution until the copy operation completes.

The file may be available for read but locked for deletion.

Check with Process Monitor which process is locking the source file.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜