update require_direcroty with exclusion and inclusion logic