在复制目录和文件时,如果需要显示操作进度框。可以引入Microsoft.VisualBasic组件实现。

     (1)引用Microsoft.VisualBasic。

     (2)代码如下:

using System;
using System.Collections.Generic;
using System.Text;
using Microsoft.VisualBasic.FileIO;
  class FileProgressDialog
    {
        static void Main()
        {
            
            string sourcePath = @"C:\testDir\subTestDir\";
            string targetPath = @"C:\testDir\subTestDirTwo";
            //通过该方法复制目录,可以复制子目录和文件
            FileSystem.CopyDirectory(sourcePath, targetPath, UIOption.AllDialogs);
        }
    }

 

相关文章:

  • 2022-12-23
  • 2021-08-25
  • 2021-10-24
  • 2021-06-22
  • 2022-01-12
  • 2021-06-27
  • 2022-12-23
猜你喜欢
  • 2022-02-14
  • 2022-12-23
  • 2022-12-23
  • 2021-08-30
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
相关资源
相似解决方案