public static String getBaseName ( File f ) { String fileName = f . getName ( ) ; int index = fileName . lastIndexOf ( ' ' ) ; return index == - 1 ? fileName : fileName . substring ( 0 , index ) ; }
Returns the file name without its path or extension . This method is named after the basename Unix command .