I have 3600 files named PKA.dump
One of these files is not the right size. They should be above 500bytes, but one is below 500. Is there a way to check all subsubfolders and find the one file named PKA.dump that is less than 500 bytes?
Sorry I meant to add I am using powershell.
I had it working in linux, but powershell is so new to me
The following should do:
Get-Childitem -path C:\yourpath\ -Include pka.dump -recurse | where {$_.Length -le 500}
After reading the comments i did some performance testing and indeed using the -include
parameter saves (in my test case) about 15% execution time per call on average so if performance is a major concern don´t use -Filter
when using -Recurse
update
After hasing it out, best answer seems to be: Get-ChildItem -Path 'c:\\yourpath\\' -Include 'pka.dmp' -Recurse | Where-Object {$_.Length -le 500}
Get-ChildItem -Path 'c:\\yourpath\\' -Include 'pka.dmp' -Recurse | Where-Object {$_.Length -le 500}
original answer
gci -r | sort Length | select -First 10
This should list all files, pipe it to sort by size (default ascending) and select the first 10
Get-Help
, Get-Command
, Get-Member
are your friends.
Don't forget to upvote and mark answers.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.