C#判断目录和文件是否存在,不存在则创建
					当前位置:点晴教程→知识管理交流
					
					→『 技术文档交流 』
					
				 
				
 1、判断文件夹是否存在 //spath:文件夹路径名 using System.IO; if (Directory.Exists(spath)) { 
 } else { DirectoryInfo directoryInfo = new DirectoryInfo(spath); directoryInfo.Create(); } 2、判断文件是否存在 // filePath 文件路径名 if (!File.Exists(filePath)) { //MessageBox.Show(filePath + " not exists!"); FileStream fs = File.Create(filePath);//创建文件 fs.Close(); return ; } else { MessageBox.Show(filePath + " exists!"); //执行读写操作 } 该文章在 2023/12/27 22:05:46 编辑过  | 
		
			 关键字查询 
				相关文章 
				正在查询...  |