getBasename function supports filenames with multiple '.' in extension