Install/OnPrem/XP/AllInOne/Uninstall/Delete-Folders.ps1

$ErrorActionPreference = "Stop"

$sitecoreRootDir = $global:Configuration.sitecore.installDir
$xConnectRootDir = $global:Configuration.xConnect.installDir

Write-Output "Deleting folders started..."

$dirs = @("$sitecoreRootDir", "$xConnectRootDir")
foreach ($dir in $dirs) {
    if (Test-Path $dir) {
        Write-Output "Deleting '$dir'..."
        Remove-Item $dir -Recurse -Force | Out-Null
    }
    else {
        Write-Warning "'$dir' doesn't exist..."
    }
}

Write-Output "Deleting folders done."