Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save colegatron/3559b623a838fb4929aa to your computer and use it in GitHub Desktop.
Save colegatron/3559b623a838fb4929aa to your computer and use it in GitHub Desktop.
Find folder named "Content" and delete them recursively
$folderToRemove = "Contents"
$rootFolder = "e:\import_logs"
$folders = Get-ChildItem -Recurse -Force $rootFolder -ErrorAction SilentlyContinue | Where-Object { ($_.PSIsContainer -eq $true) -and ( $_.Name -like $folderToRemove) }
foreach ($folder in $folders) {
write-host "Removing " $folder.FullName
remove-item -re -fo $folder.FullName
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment