标题: [原创代码] PowerShell递归删除某文件夹内小于1KB的文件 [打印本页]
作者: gflrlm 时间: 2020-1-4 23:12 标题: PowerShell递归删除某文件夹内小于1KB的文件
如题, 设置文件大小 :
$file_size_deleted = 1024 # del file which is less than 1024 bytes
- $file_size_deleted = 1024 # del file which is less than 1024 bytes
-
- function processing_grep( $file ){
- #write-host "** = " $file
- $fsize= (Get-Item $file).Length
- if($fsize*1 -le $file_size_deleted) {
- write-host " file_size_deleted : " $fsize -ForegroundColor green
- del $file
- }
-
- }
-
- ,@( Get-ChildItem -Path $Path | ?{$_.psiscontainer -eq $false} | %{processing_grep ($_.FullName )} )
复制代码
欢迎光临 批处理之家 (http://bathome.net./) |
Powered by Discuz! 7.2 |