# File_ExistDir

> Check for directory existence.

Source: https://docs.capaone.com/capainstaller/vb-scripting-library/file-functions/file-existdir/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Check for directory existence

### Syntax

File_ExistDir(sDirectory, bMustExist) As Boolean

### Parameters

#### sDirectory (String)

Directory to find

#### bMustExist (String)

Directory must exist

### Return value

Result will be stored in gbValue. Function will return false if directory does not exist and bMustExist is true

### Example

**VBScript**

```vb
If bStatus Then bStatus = File_ExistDir("C:\CapaInstaller", False)
If bStatus and Not gbValue Then bStatus = File_CreateDirectory("C:\CapaInstaller")
```

[Scripting Guidelines](/capainstaller/vb-scripting-library/scripting-guidelines/)

### Related functions

[File_CreateDirectory](/capainstaller/vb-scripting-library/file-functions/file-createdirectory/) [File_CopyTree](/capainstaller/vb-scripting-library/file-functions/file-copytree/) [Constants](/capainstaller/vb-scripting-library/addendum/constants/) [Package Property](/capainstaller/vb-scripting-library/addendum/package-property/) [Variables](/capainstaller/vb-scripting-library/addendum/variables/)
