code: public static void deleteRecursively(File file, FilenameFilter filter) throws IOException {
      if (file == null) { return; }
  
      // On Unix systems, use operating system command to run faster
      // If that does not work out, fallback to the Java IO way
      if (SystemUtils.IS_OS_UNIX && filter == null) {
        try {
          deleteRecursivelyUsingUnixNative(file);
          return;
        } catch (IOException e) {
          logger.warn("Attempt to delete using native Unix OS command failed for path = {}. " +
                          "Falling back to Java IO way", file.getAbsolutePath(), e);
        }
      }
  
      deleteRecursivelyUsingJavaIO(file, filter);
    }
docs: Delete a file or directory and its contents recursively.
  Don't follow directories if they are symlinks.
  
  @param file Input file / dir to be deleted
  @param filter A filename filter that make sure only files / dirs with the satisfied filenames
  are deleted.
  @throws IOException if deletion is unsuccessful