$path = "d:/000"
$items = Get-ChildItem -Recurse $path |Where-Object -FilterScript {($_.psiscontainer -eq $false) -and ($_.length -eq 0)}
if ( $items.exists)
{
"EmptyFiles :"
$items
$items.delete()
}
else
{
"NO Empty File!"
}
本文介绍了一个使用 PowerShell 编写的脚本,该脚本能递归地搜索指定目录及其子目录中的空文件,并将这些空文件进行删除。通过 Get-ChildItem 命令结合 Where-Object 进行过滤,最终实现自动化清理任务。
517

被折叠的 条评论
为什么被折叠?



