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;
  }
public static String getBasename ( final File file ) { final String path = file . getPath ( ) ; String basename = file . getName ( ) ; final int pos = basename . lastIndexOf ( '.' ) ; if ( pos != - 1 ) { basename = basename . substring ( 0 , pos ) ; } return basename ; }
Extracts the basename of a file, removing the extension, if present