code: public static void copyDirToDir(File source, File dest, FilenameFilter filter) throws IOException {
          if (!source.isDirectory() || !dest.isDirectory()) {
              return;
          }
  
          List<File> files = listFiles(source, filter, true);
          String sourcePath = source.getAbsolutePath();
          String destPath = dest.getAbsolutePath();
          for (File file : files) {
              String filePath = file.getAbsolutePath();
              if (sourcePath.equals(filePath)) {
                  continue;
              }
              String newPath = destPath + File.separator + filePath.substring(sourcePath.length());
              File destFile = new File(newPath);
              if (file.isDirectory()) {
                  destFile.mkdirs();
              } else {
                  copy(file, destFile);
              }
          }
      }
docs: dest directory must be already created!