Move directory blacklist creation to a utility method.