引用 System.IOstring dirpath =...//具体自己添string filepath=...//具体自己添if (Directory.Exists(path))//判断目录是否存在{}if(File.Exist(filepath))//如果是文件的话{}