I'm checking the latest file created in a folder, and if it's GT than 1K ... I'm going to do further processing..
Is this a correct way to check that?
Thanks.
$path = '\\uprd\pub\zebr\performance\dblocks\'
$file = Get-ChildItem -Path $Path |?{-not $_.PsIsContainer} | Sort CreationTime | Select -Last 1
Write-Output "The most recently created file is $($file.Name)"
If ($file.Length/1024 -gt 1KB)
....
I'm checking the latest file created in a folder, and if it's GT than 1K ... I'm going to do further processing..
Is this a correct way to check that?
Thanks.
$path = '\\uprd\pub\zebr\performance\dblocks\'
$file = Get-ChildItem -Path $Path |?{-not $_.PsIsContainer} | Sort CreationTime | Select -Last 1
Write-Output "The most recently created file is $($file.Name)"
If ($file.Length/1024 -gt 1KB)
....
Try it and compare what DOS says. It's that easy.
--Jeff Moden
Change is inevitable... Change for the better is not.
September 20, 2021 at 6:42 pm
If ($file.Length -gt 1024) -- Worked.
Thanks
Viewing 3 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy