# DirectoryExists (String filePath)

| **Name**    | ***DirectoryExists***                                                                           |
| ----------- | ----------------------------------------------------------------------------------------------- |
| Syntax      | DirectoryExists (String filePath)                                                               |
| Purpose     | To check and return either ‘True’ or ‘False’ depending on whether a specified directory exists. |
| Description | Checks whether a directory exists.                                                              |
| Return Type | Boolean                                                                                         |
| Parameter   | filePath \[System.String] – Path of the directory to check.                                     |

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2F1uJQt6Ecr1pKxB8myT6F%2F0.png?alt=media)

**Example**

In this example, we are passing the required parameter to the function transformation object using a *Variables* object. We will be checking for an existing directory.

Where,

*filePath* = *C:\Users\Kanwal.Azim\OneDrive - Astera Software\Desktop\Functions Documentation\Files*

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FKDQ0ijQIVK2OhgYaNIJn%2F1.png?alt=media)

Right-click on the function transformation object and select *Preview Output.* As you can see, Astera Data Stack has returned the Boolean value “True”, as this directory does exist.

![](https://3083465318-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FsR50Wa7EwZGlmPSAMkkf%2Fuploads%2FjE1u1MSQRYEfEu9TKFby%2F2.png?alt=media)
