I need to process files in order from oldest create date to newest.
I found the sort-object command which is what I need however I don't have a clue how to add it to my ForEach() statement.
Can someone show me how to do it?
Thanks
Get-ChildItem -Path C:\Users\Tom\ -Filter "*.journal" | Sort-Object -Property CreationTime
ForEach ($sourcefile In $(Get-ChildItem $source | Where-Object { $_.Name -match "Daily_Reviews\[\d{1,12}-\d{1,12}\].journal" }))
{
#### Process files in order from oldest to newest
$file = $source+$sourcefile
}