1. 程式人生 > WINDOWS開發 >C# 判斷資料夾、檔案是否存在

C# 判斷資料夾、檔案是否存在

 if (Directory.Exists(temp_path) == false)//如果不存
   { 
       //在就建立file資料夾
       Directory.CreateDirectory(temp_path);
   }
if (!System.IO.File.Exists(filename))
   {
     System.IO.File.Create(filename);//建立該檔案 
    }