Helix Core is now P4. Product user interfaces will be updated soon. Learn more >>

P4 CLI Documentation | 2026.1

# p4 dirs

List the immediate subdirectories of the specified depot directories.

## Syntax

    p4 [g-opts] dirs [-C -D -H] [-S stream] [-i] depot_directories*[revSpec]
    p4 [g-opts] dirs [-D] [--streamviews]  depot_directories*[revSpec]

Syntax and naming conventions

## Description

Use p4 dirs to find the immediate subdirectories of any depot directories provided as arguments. This command is meant to be used in scripts rather than from the command line.

If you use streams, you must provide the depot_directories argument in depot syntax. Otherwise, you can use depot or local syntax. The argument must end with the `*` wildcard.

p4 dirs only lists the immediate subdirectories of the directory arguments.

By default, only subdirectories that contain at least one undeleted file will be returned. To include those subdirectories that contain only deleted files, use the `-D` option.

If you include a revision specifier or revision range as part of a directory argument, the only subdirectories returned are those that contain at least one file revision that matches the given specifier.

## Options

Option | Description
--- | ---
`-C` | Display only those directories that are mapped through the current client view.
`-D` | Include subdirectories that contain only deleted files. By default, these directories are not displayed.
`-H` | Include only those directories that contain files on the current client workspace’s `p4 have` list.
`-S stream` | List directories mapped for the specified stream.
`--streamviews` | Report files and directories from stream Paths and Components, where imported files are represented as symbolic links under the stream depot path. See the Viewing imported files example under Stream components. When using this option, you should provide arguments in depot syntax.
`-i` | Ignore the case of the directory argument when listing directories in a case-sensitive server.
`--ignore-changeview` | Remove the changelist limit on depot paths. See ChangeView in p4 client.
`g-opts` | See Global options.

## Usage notes

Can file arguments use revision specifier? | Can file arguments use revision range? | Minimal access level required
--- | --- | ---
Yes | Yes | `list`

P4 Server does not track directories in its database. Therefore, the "`...`" wildcard is not supported.

## Examples

`p4 dirs //depot/projects/*` | Returns a list of all the immediate subdirectories of `//depot/projects`, such as //depot/projects/test and //depot/projects/prod
`p4 dirs //depot/projects/*/*` | Returns a list of all the subdirectories two levels below `//depot/projects`, such as //depot/projects/test/t1 and //depot/projects/prod/p1
`p4 dirs //depot/a/* //depot/b/*` | Returns a list of all immediate subdirectories of `//depot/a` and `//depot/b`.
`p4 dirs -i //depot/read*` | Case-insensitive version retrieves //depot/README.TXT, //depot/ReadMe.html, and so on.

## Related commands

To list all the files that meet particular criteria | `p4 files`
To list all depots known to the P4 Server | `p4 depots`

Your search for returned results