make sure that the end directory exists