---
url: /process-functions/datasource-folders.md
description: >-
  Lists all the folders (directories) in a specified directory from the MODLR
  filesystem.
---

# datasource.folders

Lists all the folders (directories) in a specified directory from the MODLR filesystem.

```js
datasource.folders(directory_name)
```

#### Parameters

* `directory_name` (string): The name of the directory whose sub-folders you want to list.

#### Returns

* `Array`: An array containing the names of all folders in the specified directory. If the directory is invalid or contains no folders, an empty array is returned.

#### Examples

```js
var folderList = datasource.folders("my_directory/");
if (folderList.length > 0) {
    console.log("Folders in the directory:", folderList);
} else {
    console.log("No folders found in the directory.");
}
```
