updated script to work with mkdir instead of ensureDir