删除文佳夹可使用Directory类的Delete方法来实现

格式为:Directory.Delete();

 

在删除文件夹前 ,一定要判断文佳夹是否存在,否则将会出现错误

 class Program
    {
        static void Main(string[] args)
        {
            string path=@"D:\51zxw";
            if (Directory.Exists(path))
            {
                Directory.Delete(path);
                Console.WriteLine("文件删除成功");
            }
            else
            {
                Console.WriteLine("文佳夹删除不成功,文佳夹不存在");
            }
            Console.Read();
        }
    }

 

相关文章:

  • 2021-11-20
  • 2021-11-23
  • 2021-05-16
  • 2021-05-16
  • 2021-09-27
  • 2022-01-04
  • 2021-06-09
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-01-24
  • 2022-12-23
  • 2021-09-17
  • 2022-12-23
  • 2021-11-20
相关资源
相似解决方案