Java: Copy File

/**
 * Copies a file, overwrites the target if that exists
 * @param source
 * @param target
 * @throws IOException
 */
public static void copyFile(String source, String target) throws IOException {

 File s = new File(source);
 File t = new File(target);

 Files.copy(s.toPath(), t.toPath(), StandardCopyOption.REPLACE_EXISTING);    

}

Werbung



comments powered by Disqus

Copyright Dunkel & Iwer GbR | Datenschutzerklärung | Impressum