DRY codes for make directory.