Exemplo n.º 1
0
 public static void copyDir(File sourceDir, File targetDir) throws IOException {
   targetDir.mkdirs();
   String files[] = sourceDir.list();
   for (int i = 0; i < files.length; i++) {
     if (files[i].equals(".") || files[i].equals("..")) continue;
     File source = new File(sourceDir, files[i]);
     File target = new File(targetDir, files[i]);
     if (source.isDirectory()) {
       // target.mkdirs();
       copyDir(source, target);
       target.setLastModified(source.lastModified());
     } else {
       copyFile(source, target);
     }
   }
 }