Java tutorial
//package com.java2s; //License from project: Apache License import java.io.File; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.InputStream; public class Main { public static void copyFile(String oldPath, String newPath) { try { int byteRead; File oldFile = new File(oldPath); if (oldFile.exists()) { InputStream inStream = new FileInputStream(oldPath); FileOutputStream fs = new FileOutputStream(newPath); byte[] buffer = new byte[1444]; while ((byteRead = inStream.read(buffer)) != -1) { fs.write(buffer, 0, byteRead); } inStream.close(); } } catch (Exception e) { e.printStackTrace(); } } }