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 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply