How do I write a powershell script that gets the file with the most recent last write time from a fo

Posted by Shoko on Stack Overflow See other posts from Stack Overflow or by Shoko
Published on 2010-04-14T02:51:07Z Indexed on 2010/04/14 2:52 UTC
Read the original article Hit count: 263

Filed under:

The subject line says it all. I'd also like to do this using pipes.

I figured that I could use Get-ChildItem, Measure-Object and Where-Object, but Measure-Object doesn't like dates.

Should I have a script block which loops through each item returned from Get-ChildItem and does a comparison to see if it's the most recent? I thought that there should be a handy PS cmdlet for that.

© Stack Overflow or respective owner

Related posts about powershell