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

$ErrorActionPreference = "Stop"

$sitecoreRootDir = $global:Configuration.sitecore.installDir

Write-Output "Deleting folders started..."

$dirs = @("$sitecoreRootDir")
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."