/**
* 创建同名文件名称拼接(数字)
*
* @param path 需要创建的目录
* @return
*/
public static String recursionMkdirsFile(String path) {
String newPath = path;
for (int i = 1; i < 10000; path = newPath + "(" + i++ + ")") {
File file = new File(path);
if (file.exists()) {
} else {
file.mkdirs();
break;
}
}
return path;
}
标签:Java,String,仿制,同名,拼接,file,创建,path
From: https://www.cnblogs.com/ComfortableM/p/17027674.html