# $cs.File_DelTree

> Recursively deletes the directory at path and everything under it. If path doesn't exist, the function returns silently with no error.

Source: https://docs.capaone.com/capainstaller/powerpacks/cs-file-deltree/  
Product: CapaInstaller — a separate CapaSystems product; do not apply this page to any other.

### Description

Recursively deletes the directory at `path` and everything under it. If `path` doesn't exist, the function returns silently with no error.

### Syntax

$cs.File_DelTree(string path)

### Parameters

#### path (String)

Full path of the directory to delete.

### Return value

None.

### Example

**PowerShell**

```powershell
$cs.File_DelTree("$env:ProgramData\Notepad++")
```

Remove an old version's install folder before laying down a new one, so a version upgrade doesn't leave stale files behind:

```powershell
$cs.File_DelTree("C:\Program Files\Contoso\App-2.0")
$Source = Join-Path $global:Packageroot "kit"
$cs.File_CopyTree($Source, "C:\Program Files\Contoso\App-3.0")
```

In `Uninstall`, remove the application's entire data folder in one call, including all subfolders and files:

```powershell
$cs.File_DelTree("$env:ProgramData\Contoso\App")
```

### Related functions

[$cs.File_DelFile](/capainstaller/powerpacks/cs-file-delfile/) [$cs.File_DelEmptyFolder](/capainstaller/powerpacks/cs-file-delemptyfolder/) [$cs.File_ExistDir](/capainstaller/powerpacks/cs-file-existdir/)
