删除指定路径下所有层级的 #特定文件夹
powershell运行
$targetPath = "目标文件夹的完整路径"

# 获取目标路径下的所有名为 "metadata" 的文件夹,并删除它们
Get-ChildItem -Path $targetPath -Recurse -Directory | Where-Object { $_.Name -eq "metadata" } | ForEach-Object {
    Remove-Item -Path $_.FullName -Recurse -Force
    Write-Host "Deleted: $($_.FullName)"
}
 
 
Back to Top