---
title: "getDirList"
canonical: "https://help.vicon.com/space/ShogunPost121/1253737684/getDirList"
format: markdown
---
# Description

Gets a list of the folders found in a named folder.

You can optionally return only the subset which match a naming pattern using the `-pattern` flag. You can also search sub-folders of the directories using the `-recursive` flag.

Be sure to use forward slashes instead of back-slashes.

## Functional area

System

# Command syntax

## Syntax

> Macro (scroll-tablelayout)

|  |
| --- |
| `getDirList "searchDirectory"[-recursive] [-nameOnly] [-pattern string]` |

### Arguments

> Macro (scroll-tablelayout)

| Name | Type | Required | Comments |
| --- | --- | --- | --- |
| `searchDirectory` | string | yes | The folder for which to search for folders. Be sure to use forward slashes. |

### Flags

> Macro (scroll-tablelayout)

| Name | Flag arguments | Argument type | Exclusive to | Comments |
| --- | --- | --- | --- | --- |
| `recursive` | 0 | — | — | Searches for all folders and sub-folders under the specified folder. By default sub-folders are not searched. |
| `nameOnly` | 0 | — | — | Lists only the names of the folders rather than their full paths (e.g. "Data" for a path of "C:/MyFiles/Data/" |
| `pattern` | 1 | string | — | Searches for folders which match a specific search criteria. By default all folders are returned. The pattern must use wildcard syntax (e.g. "Data*") |

## Return value

string array

Returns a string array with all of the folders found.

## Examples

```plaintext
// Get a list of all of the folders found under my capture session.
// Also get the sub-folders.
string $dirList[] = `getDirList "C:/Data/MyProject001/" -recursive`;
print $dirList;
```

# Additional information

## Related commands

- [getFileList](https://vicon-help.atlassian.net/wiki/spaces/ShogunPost121/pages/1253736742)