If, for example, I have a directory which contains the following files:
Test-20120626-1023.txt Test-20120626-0710.txt Test-20120626-2202.txt Test-20120626-19
You could try something like this:
$dir = "C:\test_code" $latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1 $latest.name