adding support for creating empty directories
fixing bug when one directory is supplied with a trailing slash