public static boolean isexists(String s){
File f = new File(s);
if(f.exists())
return true;
else
return false;
}
/**
* @param args
*/
public static void main(String[] args) {
String str="D:\\A\\B\\C";
if(isexists(str)){
System.out.println("此文件夹存在");
}else{
//创建文件夹
File file = new File(str);
file.mkdirs();
}
}
判断文件夹是否存在,不存在则创建文件夹
最新推荐文章于 2023-11-27 10:11:03 发布