p; 是否追加
* @param time
* 复制每个文件的间隔
*/
public static void copyPathToPath(File f1, File f2, boolean override, boolean append, long time) {
if (exists(f1) && isDirectory(f1)) {
File[] farr = f1.listFiles();
for (File f : farr) {
try {
Thread.sleep(time);// 一次性复制超过5个,线程支持不住,慢点也不影响性能。
} catch (InterruptedException e) {
e.printStackTrace();
}
copyFileToPath(f, f2, override, append);
}
}
}
/**
* 复制指定路径下所有文件到指定路径(大文件需要更多时间。)
*
* @param path1
* 路径
* @param path2
* 路径
* @param override
* 是否覆盖
* @param append
* 是否追加
* @param time
* 复制每个文件的间隔
*/
public static void copyPathToPath(String path1, String path2, boolean override, boolean append, long time) {
copyPathToPath(newFile(path1), newFile(parent(newFile(path1)), path2), override, append, time);
}
/**
* 创建目录
*
* @param f
*/
public static void createDire(File f) {
FileUtilHelp.createMkdirs(f.getAbsolutePath());
}
/**
* 根据路径创建目录
*
* @param path
*/
public static void createDire(String path) {
createDire(newFile(path));
}
/**
* 不覆盖的创建文件
*
* @param f
*/
public static void createFile(File f) {
createFile(f, false);
}
/**
* 创建文件
*
* @param f
* 文件对象
* @param override
* 是否覆盖
*/
public static void createFile(File f, boolean override) {
FileUtilHelp.createMkdirs(parent(f));
if (override) {
f.delete();
}
if (!exists(f)) {
try {
f.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
}
&nb