20 lines
527 B
PowerShell
20 lines
527 B
PowerShell
|
[CmdletBinding()]param(
|
||
|
[Parameter(ValueFromPipeline,ValueFromPipelineByPropertyName,Position=0,Mandatory)]
|
||
|
[Alias('FullName')]
|
||
|
[string[]]$Path
|
||
|
)
|
||
|
|
||
|
begin {}
|
||
|
process {
|
||
|
$Path |
|
||
|
Get-ChildItem -Directory -Recurse |
|
||
|
Where-Object {
|
||
|
0 -eq (Get-ChildItem -File -Recurse ($_.FullName -replace '([\[\]])','`$1')).Length
|
||
|
} |
|
||
|
ForEach-Object {
|
||
|
Write-Host "Removing $($_.FullName)..."
|
||
|
Remove-Item -Force -Recurse -LiteralPath $_.FullName
|
||
|
}
|
||
|
}
|
||
|
end {}
|