Escape directory name

Should fix #1036