Last active
January 31, 2018 01:40
-
-
Save lanekatris/46943cf60586c4b061b00f74a6bcf4ac to your computer and use it in GitHub Desktop.
Run like this:
This file contains hidden or 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
# .\test.ps1 -path c:\temp | |
param ( | |
[Parameter(Mandatory=$true)] | |
[string]$path, | |
[string]$folderName = "references" | |
) | |
Write-Host "Looking for folders with the name $folderName here: $path" | |
$folders = Get-ChildItem -Path $path -Filter $folderName -Recurse -Directory | |
$count = $folders.Length | |
Write-Host "Found $count folders with the name $folderName. Here are their paths: " | |
write-host "===================" | |
Write-Host "" | |
foreach ($folder in $folders) { | |
Write-Host $folder.FullName | |
} | |
Read-Host "Want to delete them? [enter WILL DELETE]" | |
$folders | Remove-Item -Force -Recurse | |
Write-Host "" | |
write-host "===================" | |
write-host "Done" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment