# File_CopyTree

> Copies a directory tree to a target directory, optionally deleting the target before the copy.

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

### Description

Copies a folder

### Syntax

File_CopyTree(sSourceDir, sTargetDir, bRemoveTarget) As Boolean

### Parameters

#### sSourceDir (String)

Source directory

#### sTargetDir (String)

Target directory

#### bRemoveTarget (Boolean)

Remove target before copying

### Example

**VBScript**

```vb
If bStatus Then bStatus = File_CopyTree(gsPackageRoot & "\Kit\Config", gsProgramFiles & "\CapaInstaller\Config", True)
```

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

### Related functions

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