使用c#.net将一个文件夹数据复制到带有进度条的另一个文件夹的代码 [英] code for copy one folder data to another folder with progress bar using c#.net

查看:257
本文介绍了使用c#.net将一个文件夹数据复制到带有进度条的另一个文件夹的代码的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

使用进度条将一个文件夹数据复制到另一个文件夹并使用c#.net

解决方案

搜索有关SHFileOperation的文章的代码。

我认为这个功能可以帮到你。



祝你好运。


而不是只是给你代码,我会给你一些伪代码。您应该能够轻松地将逻辑转换为实际代码。

如果源目录不存在则不执行操作
如果目标目录不存在,请创建目录

为文件复制操作创建后台任务
对于源目录中的每个文件
如果目标目录中不存在该文件
将文件复制到目标目录
如果
结束报告复制回主线程的文件百分比。
下一页

对于基于任务的工作,我建议在 BackgroundWorker 任务 $ C>


code for copy one folder data to another folder with progress bar and calculating time time also using c#.net

解决方案

Search article about SHFileOperation.
I think this function will do it for you.

Best regards.


Rather than just giving you the code, I''ll give you some pseudo code. You should be able to convert the logic into actual code with ease.

If source directory doesn't exist take no action
If destination directory doesn't exist, create the directory

Create a background task for the file copy operation
For each file in the source directory
  If the file doesn't exist in the destination directory
    Copy the file into the destination directory
  End if
  Report the percentage of files copied back to the primary thread.
Next

For the task based work, I''d recommend using Task over BackgroundWorker.


这篇关于使用c#.net将一个文件夹数据复制到带有进度条的另一个文件夹的代码的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆