code: public static String getBasename(final File file) {
      final String path = file.getPath();
      // Remove the extension
      String basename = file.getName();
      final int pos = basename.lastIndexOf('.');
      if (pos != -1) {
        basename = basename.substring(0, pos);
      }
      return basename;
    }
docs: Extracts the basename of a file, removing the extension, if present