allow dirname to work with a folder containing spaces