Quantcast
Channel: Windows PowerShell forum
Viewing all articles
Browse latest Browse all 21975

Pipeline variable - scope number exceeded

$
0
0

Hello,

I have a script to select the oldest file form $srcdatapath folder:

$oldFile = Get-ChildItem -Path $srcDataPath | Sort-Object -Property LastWriteTime | Select-Object -First 1

Then I need to select all files with LastWriteTime at the same date from the same path:

if($oldFile)
{
    $oldFilesDay = Get-ChildItem -Path $srcDataPath | Where-Object { $_.LastWriteTime.Date -eq $oldFile.LastWriteTime.Date  
}
It gaves me no record and debug displays an error:

The scope number '1' exceeds the number of active scopes.Parameter name: scopeIDActual value was 1.

Could you advise how to push the variable to pipeline?

Thanks



Viewing all articles
Browse latest Browse all 21975

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>