Java Utililty Methods Recursive Copy

List of utility methods to do Recursive Copy

Description

The list of methods to do Recursive Copy are organized into topic(s).

Method

voidrecursiveCopy(File copyFromDir, File copyToDir, boolean overwrite)
Will recursively copy the contents of copyFromDir to copyToDir creating any directories in the copyToDir that are necessary.
try {
    copyToDir.mkdirs();
    File[] filesToCopy = copyFromDir.listFiles();
    File newDirectory;
    String slash = System.getProperty("file.separator");
    File newFile;
    for (int i = 0; i < filesToCopy.length; i++) {
        if (filesToCopy[i].isDirectory()) {
...
voidrecursiveCopy(File sourceFile, File targetLocation)
recursive Copy
if (sourceFile.isFile()) {
    copyFile(sourceFile, new File(targetLocation, sourceFile.getName()));
    return;
File targetFolder = new File(targetLocation, sourceFile.getName());
targetFolder.mkdir();
File[] subFiles = sourceFile.listFiles();
for (int i = 0; i < subFiles.length; i++) {
...
voidrecursiveCopy(File src, File dest)
recursive Copy
if (src.isDirectory()) {
    if (!dest.exists()) {
        dest.mkdirs();
    for (String file : src.list()) {
        File srcFile = new File(src, file);
        File destFile = new File(dest, file);
        recursiveCopy(srcFile, destFile);
...
voidrecursiveCopyDir(File source, File destination)
recursive Copy Dir
if (source.isDirectory()) {
    if (!destination.exists()) {
        if (!destination.mkdirs()) {
            throw new IOException("The destination directory could not be created.");
    String files[] = source.list();
    for (String file : files) {
...
File[]recursiveCopyFile(File srcDir, File destDir)
Recursively copy all files from one directory to another.
if (srcDir == null || destDir == null)
    throw new IllegalArgumentException();
File parentDir = destDir.getParentFile();
while (parentDir != null) {
    if (parentDir.equals(srcDir))
        return new File[] { srcDir };
    parentDir = parentDir.getParentFile();
return actualRecursiveCopyFile(srcDir, destDir);