wifi

 

方法1: 

C#代码  
if (Directory.Exists("d:\\pic"))   
{   
    MessageBox.Show("存在");   
}   
else  
{   
    MessageBox.Show("不存在");   
}     
方法2: 

C#代码  
DirectoryInfo TheFolder = new DirectoryInfo("d:\\pic");   
if (TheFolder.Exists)   
{   
    MessageBox.Show("进来了");   
}   
else  
{   
    MessageBox.Show("没进来");   
}  
"d:\\pic"可以这样变成路径 
@"d:\pic" 
也就是说转义符可以用@来代替 

新建文件夹: 

C#代码  
if (!Directory.Exists(@txtFileSaveDir.Text))//若文件夹不存在则新建文件夹   
{   
    Directory.CreateDirectory(@txtFileSaveDir.Text); //新建文件夹   
}  

 

 

分类:

技术点:

相关文章:

  • 2021-12-22
  • 2021-12-22
  • 2021-11-18
  • 2021-12-27
  • 2021-11-17
  • 2021-11-17
猜你喜欢
  • 2021-12-06
  • 2021-06-01
  • 2021-10-29
  • 2021-04-24
  • 2021-12-09
  • 2021-09-03
  • 2021-11-19
  • 2021-12-24
相关资源
相似解决方案