get the latest file in a directory powershell code example
Example: get the latest file in a directory powershell
$dir = "C:\test_code"
$latest = Get-ChildItem -Path $dir | Sort-Object LastAccessTime -Descending | Select-Object -First 1
$latest.name