开发者

How can I know the bytes current being copied during copying large file in .net?

开发者 https://www.devze.com 2023-04-12 17:24 出处:网络
How can I know the bytes current being copied 开发者_运维问答during copying large file in .net?

How can I know the bytes current being copied 开发者_运维问答during copying large file in .net?

I used to File.Copy method for copying file.

The problem is I can't know the current state during copying file.

Is there anyway that I can check how much the file is being copied? or get a return value?

If not, do I have to make my own method with Filestream or something?

Sorry about my poor English & thanks in advance.


I would leave copying to the OS rather than rolling out your own, you can use the CopyFileEx API which implements a progress callback (pinvoke).


The problem is I can't know the current state during copying file.

Just use the following method: http://msdn.microsoft.com/en-us/library/windows/desktop/aa364957(v=vs.85).aspx

Is there anyway that I can check how much the file is being copied? or get a return value?

Check the size on the file being created in the new location using a similar method as above.

If not, do I have to make my own method with Filestream or something?

You really should avoid doing something that operating system does.

0

精彩评论

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