Powershell 自动删除当前用户下微信缓存文件图片和视频

网友投稿 585 2022-09-13

Powershell 自动删除当前用户下微信缓存文件图片和视频

Powershell 自动删除当前用户下微信缓存文件图片和视频

$p = (Get-ChildItem -Path C:\Users$env:USERNAME\Documents\"Wechat Files").Name

foreach($p in $p){

if( test-path -Path C:\Users\$env:USERNAME\Documents\'Wechat Files'\$p\FileStorage ){

Set-Location C:\Users\$ENV:USERNAME\Documents\"Wechat Files"\$p

$n = (Get-ChildItem -Path .\FileStorage\Image).count

Get-ChildItem -Path .\FileStorage\Image | Select-Object -First ($n-1) | Remove-Item -Recurse

$m = (Get-ChildItem -Path .\FileStorage\Video).count

Get-ChildItem -Path .\FileStorage\Video | Select-Object -First ($m-1) | Remove-Item -Recurse

}else{

write-host "$p Folder of non-wechat account"

}

}

版权声明:本文内容由网络用户投稿,版权归原作者所有,本站不拥有其著作权,亦不承担相应法律责任。如果您发现本站中有涉嫌抄袭或描述失实的内容,请联系我们jiasou666@gmail.com 处理,核实后本网站将在24小时内删除侵权内容。

上一篇:Excel 2016 打开文件第一次打不开,有时空白,有时很慢要打开第二次才行
下一篇:架构师内功心法之设计原则(架构设计方法)
相关文章

 发表评论

暂时没有评论,来抢沙发吧~