Improve how slashes are stripped from filenames