---
title: Directory
description: The Directory integration reports metrics on files for a provided directory
breadcrumbs: Docs > Integrations > Directory
---

# Directory
Supported OS Integration version4.4.0
## Overview{% #overview %}

Capture metrics from directories and files of your choosing. The Agent collects:

- Number of files
- File size
- Age of the last modification
- Age of the creation

**Minimum Agent version:** 6.0.0

## Setup{% #setup %}

### Installation{% #installation %}

The Directory check is included in the [Datadog Agent](https://app.datadoghq.com/account/settings/agent/latest) package, so you don't need to install anything else on your server.

### Configuration{% #configuration %}

1. Edit the `directory.d/conf.yaml` file, in the `conf.d/` folder at the root of your [Agent's configuration directory](https://docs.datadoghq.com/agent/guide/agent-configuration-files/#agent-configuration-directory) to start collecting Directory performance data. See the [sample directory.d/conf.yaml](https://github.com/DataDog/integrations-core/blob/master/directory/datadog_checks/directory/data/conf.yaml.example) for all available configuration options.

   ```yaml
   init_config:
   
   instances:
     ## @param directory - string - required
     ## The directory to monitor. On windows, please make sure you escape back-slashes otherwise the YAML
     ## parser fails (eg. - directory: "C:\\Users\\foo\\Downloads").
     #
     - directory: "<DIRECTORY_PATH>"
   ```

Ensure that the user running the Agent process (usually `datadog-agent`) has read access to the directories, subdirectories, and files you configure.

**Note**: On Windows when you add your directory, use double-backslashes `C:\\path\\to\\directory` instead of single-backslashes `C:\path\to\directory` for the check to run. Otherwise, the directory check fails with traceback ending in the error: `found unknown escape character in "<string>"`.

1. [Restart the Agent](https://docs.datadoghq.com/agent/guide/agent-commands/#start-stop-and-restart-the-agent).

### Validation{% #validation %}

[Run the Agent's status subcommand](https://docs.datadoghq.com/agent/guide/agent-commands/#agent-status-and-information) and look for `directory` under the Checks section.

## Data Collected{% #data-collected %}

### Metrics{% #metrics %}

|  |
|  |
| **system.disk.directory.bytes**(gauge)                   | Total size of the directory*Shown as byte*        |
| **system.disk.directory.file.bytes**(gauge)              | Total size of the file*Shown as byte*             |
| **system.disk.directory.file.created\_sec\_ago**(gauge)  | Duration since creation*Shown as second*          |
| **system.disk.directory.file.modified\_sec\_ago**(gauge) | Duration since last modification*Shown as second* |
| **system.disk.directory.files**(gauge)                   | Number of files in the directory*Shown as file*   |
| **system.disk.directory.folders**(gauge)                 | Number of folders in the directory*Shown as file* |

### Events{% #events %}

The Directory check does not include any events.

### Service Checks{% #service-checks %}

**system.disk.directory.exists**

Returns `WARNING` if the Agent is unable to find or access the directory to monitor, `OK` otherwise.

*Statuses: ok, warning*

## Troubleshooting{% #troubleshooting %}

When running the check against very large directories and recursion is set to true, be aware that is an intensive operation on the I/O and CPU. The default check frequency, every 15 seconds, may need to be adjusted.

For example, if there is a directory with 15,000 files and sub-directories, and the check runs 30-40 seconds with high CPU usage, if you do not set up less frequent check frequency, the check with high CPU runs effectively and continuously.

Need help? Contact [Datadog support](https://docs.datadoghq.com/help/).
