获取最大的文件列表可能看起来像
gci -r|sort -descending -property length | select -first 10 name, length如何添加特定的文件类型选择,如ascii或格式化的log/json/yaml文件?
选择年龄在30天以上的人也是个好主意。
我的目标是积累过滤器:
我可以将这一需求与满足所有需求的linux命令行进行比较:
find . -type f -ctime +30 ! -executable -exec file {} + | grep -i ASCII | du -ah | sort -rh | head -10发布于 2021-01-20 14:10:56
有人给了我一个解决办法
$refDate = (Get-Date).AddDays(-30).Date
# fill the list of binary filetypes that are most likely found
$binaries = '*.exe', '*.bin', '*.png', '*.gif', '*.jpg', '*.dll' # I will complete here known extensions
Get-ChildItem -File -Recurse -Exclude $binaries |
Where-Object {$_.LastWriteTime -lt $refDate} |
Sort-Object Length -Descending |
Select-Object -First 10 |
Select-Object Name, Length这看起来很好,可以继续工作。
https://serverfault.com/questions/1050431
复制相似问题