code: public static void deleteFilesByExtension(File dir, String extension) {
          if(extension == null) {
              throw new DataUtilException("Filename extension can not be a null value");
          }
          FilenameFilter filter = new FileExtensionFilenameFilter(extension);
          FileDeleter.deleteFiles(dir, filter);
      }
docs: Delete files in a directory matching a file extension
  @param dir directory
  @param extension filename extension