Fix issue when directory name has spaces in it

Thanks for your WCPHX talk - I've been meaning to use this script for a while.