Powershell: Remove Empty Directories
November 20, 2021
10:56 AM
do{
  $dirs= gci $tdc-directory-recurse | Where { (gci $_.fullName -Force).count -eq 0} | select -expandproperty FullName
  $dirs| Foreach-Object{ Remove-Item $_}
} while($dirs.count -gt 0)
From <[link]> 