easypass

一、判断文件夹是否存 

1、方法一 

if (Directory.Exists("d:\\pic"))  

{

   MessageBox.Show("存在"); 

}

else

{

   MessageBox.Show("不存在");   

 2、方法二

DirectoryInfo TheFolder = new DirectoryInfo("d:\\pic");   

 if (TheFolder.Exists)  

{

   MessageBox.Show("存在"); 

}

else

{

   MessageBox.Show("不存在");   

二、文件是否存在

if (File.Exists("d:\\pic\\aa.txt"))  

{

   MessageBox.Show("存在"); 

}

else

{

   MessageBox.Show("不存在");   

分类:

技术点:

相关文章:

  • 2021-11-06
  • 2021-11-06
  • 2021-07-03
  • 2021-09-16
  • 2021-08-16
  • 2021-08-04
猜你喜欢
  • 2021-08-16
  • 2021-12-28
  • 2021-05-20
  • 2021-10-17
  • 2021-11-22
  • 2021-09-27
  • 2021-11-27
相关资源
相似解决方案