C#编程-112:文件夹操作之判断是否存在

133 阅读1分钟
  1. using System;

  2. using System.Collections.Generic;

  3. using System.Linq;

  4. using System.Text;

  5. using System.IO;

  6. namespace DirectoryTest

  7. {

  8.     class Program

  9.     {

  10.         static void Main(string[] args)

  11.         {

  12.             string path = @"C:\Users\pengshiyu\Desktop\source";

  13.             if(Directory.Exists(path))

  14.                 Console.WriteLine("文件夹存在 "+path);

  15.             else

  16.                 Console.WriteLine("文件夹不存在 "+path);

  17.             Console.ReadKey();

  18.         }

  19.     }

  20. }

C#编程-112:文件夹操作之判断是否存在

C#编程-112:文件夹操作之判断是否存在
\