Created
February 28, 2018 17:09
-
-
Save royashbrook/95b6d08f17d0910243c6f3c6e7934d70 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# all files | |
$a = Get-Item *.txt | |
# prefix of latest file | |
$b = $a | | |
sort -Property LastWriteTime -Descending | | |
select -First 1 @{n='dts';e={$_.name.split('_')[0]}}).dts | |
# files with that prefix | |
Get-Item "$b*.txt" | |
# one-liner that I actually did | |
(Get-Item ("{0}*.txt" -f $((Get-Item *.txt) | | |
sort -Property LastWriteTime -Descending | | |
select -First 1 @{n='dts';e={$_.name.split('_')[0]}}).dts)) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment