Java File Copy nio copy(File source, File dest)

Here you can find the source of copy(File source, File dest)

Description

copy

License

Apache License

Declaration

public static void copy(File source, File dest) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Apache License 

import java.io.File;
import java.io.IOException;
import java.nio.file.Files;

public class Main {
    public static void copy(File source, File dest) throws IOException {
        Files.copy(source.toPath(), dest.toPath());
        if (source.isDirectory()) {
            for (String s : source.list()) {
                copy(new File(source, s), new File(dest, s));
            }/*w ww.jav a2s .c  o m*/
        }
    }
}

Related

  1. copy(File in, File out, boolean overwrite)
  2. copy(File inFile, File outFile)
  3. copy(File input, File output)
  4. copy(File inputFile, OutputStream out)
  5. copy(File source, File dest)
  6. copy(File source, File dest)
  7. copy(File source, File dest)
  8. copy(File source, File dest)
  9. copy(File source, File dest, boolean preserveTime)