如何使用PowerShell删除文件夹而不是文件?我想删除超过3天的文件夹。Powershell删除文件夹
Get-ChildItem "D:\test" |
Where-Object { $_.PSIsContainer -and $_.LastWriteTime -le (Get-Date).AddDays(-3) } |
ForEach-Object { Remove-Item $_ -Force }
这是行不通的。我没有收到任何错误,也没有删除d:\ test内的任何文件夹。
嗨,有什么不工作?它不会删除任何东西?它会产生一个错误信息?请编辑您的问题以包含更多详细信息。 – sodawillow