2016-09-22 12:43:57 +00:00
---
title: About the directory Resource
2018-02-16 00:28:15 +00:00
platform: os
2016-09-22 12:43:57 +00:00
---
# directory
2019-04-26 18:24:29 +00:00
Use the `directory` Chef InSpec audit resource to test if the file type is a directory. This is equivalent to using the [`file` resource](https://www.inspec.io/docs/reference/resources/file/) and the `be_directory` matcher, but provides a simpler and more direct way to test directories.
2016-09-22 12:43:57 +00:00
2017-10-03 21:35:10 +00:00
<br>
2018-08-09 12:34:49 +00:00
## Availability
### Installation
2019-04-26 18:24:29 +00:00
This resource is distributed along with Chef InSpec itself. You can use it automatically.
2018-08-09 12:34:49 +00:00
### Version
This resource first became available in v1.0.0 of InSpec.
2016-09-27 19:03:23 +00:00
## Syntax
2016-09-22 12:43:57 +00:00
2018-02-06 11:27:09 +00:00
A `directory` resource block declares the location of the directory to be tested, and then one (or more) matchers.
2016-09-22 12:43:57 +00:00
describe directory('path') do
2018-02-06 11:27:09 +00:00
its('property') { should cmp 'value' }
2016-09-22 12:43:57 +00:00
end
2017-10-03 21:35:10 +00:00
<br>
2016-09-22 12:43:57 +00:00
2018-02-15 14:33:22 +00:00
## Properties
2018-02-06 11:27:09 +00:00
2018-10-18 03:44:20 +00:00
All of the properties available to [`file`](https://www.inspec.io/docs/reference/resources/file/) may be used with `directory`.
2018-02-06 11:27:09 +00:00
<br>
2018-02-16 02:34:11 +00:00
2017-10-03 21:35:10 +00:00
## Matchers
2016-09-22 12:43:57 +00:00
2018-02-16 03:07:18 +00:00
For a full list of available matchers, please visit our [matchers page](https://www.inspec.io/docs/reference/matchers/).