Last active
August 29, 2015 14:18
-
-
Save colegatron/3559b623a838fb4929aa to your computer and use it in GitHub Desktop.
Find folder named "Content" and delete them recursively
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$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