added flag to getName to trim the extension