powershell - How can I get the file with the oldest LastWriteTime in a directory? -
if have full-path wildcard, how can file oldest lastwritetime?
$fullpath = "myfolder:\fooobar*.txt" $theoldestfile = # write among #foobar*.txt has max lastwritetime?
like this:
$fullpath = "myfolder:\fooobar*.txt" $theoldestfile = dir $fullpath | sort lastwritetime | select -first 1
Comments
Post a Comment