# Excludes

> Restrict the scope of a Deployment Definition by excluding specific files or directories.

## Definition

Excludes are a way to restrict the scope of a [Deployment Definition].
Excludes only affect files or directories that it is responsible for.
Excludes use [glob pattern matching] to match the contents of the `excludePaths` field and the files the Deployment Definition is responsible for.

## Examples

Given the following file structure, there are multiple ways to exclude the contents of the `/Tests/` folder.

```text
Assets/
├── DeployableAssets/
│   ├── CloudCode/
│   │   ├── CloudCode.ddef
│   │   ├── scriptA.js
│   │   ├── scriptB.js
│   │   └── Tests/
│   │       ├── scriptA_test.js
│   │       └── scriptB_test.js
│   └── Remote Config/
│       ├── RemoteConfig.ddef
│       ├── configA.rc
│       └── configB.rc
```

### Glob Directory

A relative path can hide the whole `/Tests/` directory.

```text
{
    "name": "CloudeCode",
    "excludePaths": [
        "**/Tests/**"
    ]
}
```

### File Path

The **full path** to the files.

```text
{
    "name": "CloudeCode",
    "excludePaths": [
        "Assets/DeployableAssets/CloudCode/Tests/scriptA_test.js",
        "Assets/DeployableAssets/CloudCode/Tests/scriptB_test.js",
    ]
}
```

[Deployment Definition]: ./what-is-deployment-definition

[glob pattern matching]: https://github.com/kthompson/glob
