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

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -