| 48 | } |
| 49 | |
| 50 | public static void copyFile(File source, File dest) throws IOException { |
| 51 | FileInputStream fis = null; |
| 52 | FileOutputStream fos = null; |
| 53 | try { |
| 54 | fis = new FileInputStream(source); |
| 55 | fos = new FileOutputStream(dest); |
| 56 | byte[] buf = new byte[4096]; |
| 57 | int readBytes = -1; |
| 58 | while ((readBytes = fis.read(buf, 0, buf.length)) != -1) { |
| 59 | fos.write(buf, 0, readBytes); |
| 60 | } |
| 61 | } finally { |
| 62 | IOUtils.closeQuietly(fis); |
| 63 | IOUtils.closeQuietly(fos); |
| 64 | } |
| 65 | } |
| 66 | |
| 67 | public static void copy(File sourceFolder, File destFolder) throws IOException { |
| 68 | for (File file : sourceFolder.listFiles()) { |