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

# datasource.files

Lists all the files (non-directory items) in a specified directory from the MODLR filesystem.

```js
datasource.files(directory_name)
```

#### Parameters

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

#### Returns

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

#### Examples

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