| 115 | } |
| 116 | |
| 117 | private static void copyDir(File from, File to) throws IOException { |
| 118 | // Create the target directory. |
| 119 | createDir(to); |
| 120 | |
| 121 | // List children. |
| 122 | String[] children = from.list(); |
| 123 | if (children == null) { |
| 124 | throw new IOException("Could not copy directory " + from.getPath()); |
| 125 | } |
| 126 | for (String child : children) { |
| 127 | if (!".parentlock".equals(child) && !"parent.lock".equals(child)) { |
| 128 | copy(new File(from, child), new File(to, child)); |
| 129 | } |
| 130 | } |
| 131 | } |
| 132 | |
| 133 | private static void copyFile(File from, File to) throws IOException { |
| 134 | try (OutputStream out = new FileOutputStream(to)) { |