//使用System.IO.File,要检查一个文件是否存在非常简单: bool exist = System.IO.File.Exists(fileName); //如果需要判断目录(文件夹)是否存在,可以使用System.IO.Directory: bool exist = System.IO.Directory.Exists(folderName);