Skip to content

Instantly share code, notes, and snippets.

@aleem006
Created September 27, 2017 12:35
Show Gist options
  • Save aleem006/4b95209cf9ec0b16dbcfbb9d16aafde5 to your computer and use it in GitHub Desktop.
Save aleem006/4b95209cf9ec0b16dbcfbb9d16aafde5 to your computer and use it in GitHub Desktop.
Copying a file
import java.io.File;
import java.io.IOException;
import java.nio.file.CopyOption;
import java.nio.file.Files;
import java.nio.file.StandardCopyOption;
public class Main {
public static void main(String[] args) throws IOException {
File src = new File("C:\\Users\\DELL\\Desktop\\testfile4.txt");
File dst = new File("C:\\Users\\DELL\\Desktop\\testfile4.txt");
Files.copy(src.toPath(), dst.toPath(),
StandardCopyOption.REPLACE_EXISTING);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment