code: public static boolean deleteAllIfExists(final File file) {
          if ((file == null) || !file.exists()) {
              return false;
          }
  
          if (file.isDirectory()) {
              final File[] files = file.listFiles();
  
              if (N.notNullOrEmpty(files)) {
                  for (File subFile : files) {
                      if (subFile == null) {
                          continue;
                      }
  
                      if (subFile.isFile()) {
                          if (subFile.delete() == false) {
                              return false;
                          }
                      } else {
                          if (deleteAllIfExists(subFile) == false) {
                              return false;
                          }
                      }
                  }
              }
          }
  
          return file.delete();
      }
docs: Delete the specified file and all its sub files/directories if it's a directory.
  
  @param file
  @return true if the file is deleted successfully, otherwise false if the file is null or doesn't exist, or can't be deleted.