code: private static <E extends Exception> void doCopyDirectory(final File srcDir, final File destDir, final boolean preserveFileDate,
              final Try.BiPredicate<? super File, ? super File, E> filter) throws IOException, E {
          if (destDir.exists()) {
              if (destDir.isFile()) {
                  throw new IOException("Destination '" + destDir + "' exists but is not a directory");
              }
          } else {
              if (!destDir.mkdirs()) {
                  throw new IOException("Destination '" + destDir + "' directory cannot be created");
              }
          }
  
          final File[] subFiles = srcDir.listFiles();
  
          if (N.isNullOrEmpty(subFiles)) {
              return;
          }
  
          for (File subFile : subFiles) {
              if (subFile == null) {
                  continue;
              }
  
              if (filter == null || filter.test(srcDir, subFile)) {
                  final File dest = new File(destDir, subFile.getName());
  
                  if (subFile.isDirectory()) {
                      doCopyDirectory(subFile, dest, preserveFileDate, Fn.BiPredicates.alwaysTrue());
                  } else {
                      doCopyFile(subFile, dest, preserveFileDate);
                  }
              } else if (subFile.isDirectory()) {
                  final File dest = new File(destDir, subFile.getName());
                  doCopyDirectory(subFile, dest, preserveFileDate, filter);
              }
          }
  
          // Do this last, as the above has probably affected directory metadata
          if (preserveFileDate) {
              destDir.setLastModified(srcDir.lastModified());
          }
      }
docs: Internal copy directory method.
  
  @param srcDir
  the validated source directory, must not be {@code null}
  @param destDir
  the validated destination directory, must not be {@code null}
  @param preserveFileDate
  whether to preserve the file date
  @param filter
  the filter to apply, null means copy all directories and files
  @param exclusionList
  List of files and directories to exclude from the copy, may be null
  @throws IOException
  if an error occurs
  @since 1.1