List of utility methods to do Directory Copy
void | copyDirectory(File source, File destination, String endWith) copy Directory if (source.exists() && source.isDirectory()) { if (!destination.exists()) { destination.mkdirs(); File[] fileArray = source.listFiles(); for (int i = 0; i < fileArray.length; i++) { if (fileArray[i].isDirectory()) { copyDirectory(fileArray[i], ... |
void | copyDirectory(File source, File target) copy Directory if (!target.exists()) { target.mkdir(); for (String f : source.list()) { copy(new File(source, f), new File(target, f)); |
void | copyDirectory(File source, File target) copy the dirictory(include sub folders and files) from the source to the target, the copyed dirictory will be under the target. File tarpath = new File(target, source.getName()); if (source.isDirectory()) { tarpath.mkdir(); File[] dir = source.listFiles(); for (File element : dir) { copyDirectory(element, tarpath); } else { ... |
void | copyDirectory(File source, File target) Copy the given source directory (and all its contents) to the given target directory. if (!target.exists()) { target.mkdirs(); File[] files = source.listFiles(); if (files == null) { return; for (File sourceChild : files) { ... |
boolean | copyDirectory(File source, File target) Helper function used to copy the directory. if (!source.exists()) { return false; if (source.isDirectory()) { if (!target.exists()) { target.mkdir(); File[] listFile = source.listFiles(); ... |
void | copyDirectory(File source, File target) copy Directory copyDirectory(source, target, Collections.<File>emptySet()); |
void | copyDirectory(File source, File target) Copies a directory. if (!target.exists() && !target.mkdirs()) throw new IOException("The directory " + target + " could not be created."); for (File sourceFile : listAllFiles(source)) { String path = computeFileRelativeLocation(source, sourceFile); File targetFile = new File(target, path); if (!targetFile.getParentFile().exists() && !targetFile.getParentFile().mkdirs()) throw new IOException("The directory " + targetFile.getParentFile() + " could not be created."); copyStream(sourceFile, targetFile); ... |
void | copyDirectory(File sourceDir, File destDir) copy Directory if (!destDir.exists()) { destDir.mkdir(); File[] children = sourceDir.listFiles(); for (File sourceChild : children) { String name = sourceChild.getName(); File destChild = new File(destDir, name); if (sourceChild.isDirectory()) { ... |
void | copyDirectory(File sourceDir, File destDir) Copy recursively one directory to another. if (sourceDir == null) throw new IllegalArgumentException("sourceDir cannot be null"); if (destDir == null) throw new IllegalArgumentException("destDir cannot be null"); if (!destDir.exists()) { if (destDir.mkdir() == false) { throw new IOException("Cannot create destination directory " + destDir.getAbsolutePath()); if (sourceDir.exists()) { File[] children = sourceDir.listFiles(); if (children != null) { for (File sourceChild : children) { String name = sourceChild.getName(); File destChild = new File(destDir, name); if (sourceChild.isDirectory()) { copyDirectory(sourceChild, destChild); } else { copyFile(sourceChild, destChild); |
void | copyDirectory(File sourceDir, File destinationDir) copy Directory if (!sourceDir.isDirectory()) throw new IOException("sourceDir is not a directory: sourceDir = " + sourceDir); if (destinationDir.exists() && destinationDir.isFile()) throw new IOException("destinationDir exists and is a file: destinationDir = " + destinationDir); if (destinationDir.exists()) { destinationDir = new File(destinationDir, sourceDir.getName()); for (File file : sourceDir.listFiles()) { ... |