Quantcast
Channel: Windows PowerShell Forum
Viewing all articles
Browse latest Browse all 2562

sorting of files, get-childitem

$
0
0

Hi, I'm trying to create a variable with a list of some .txt files in a folder, sorted alphabetically:

$txtfiles = Get-ChildItem "$Path\*.*" -include *.txt -name | Sort name -desc

The strange thing is when i echo this variable I don't get the files sorted the way I want:

echo $txtfiles
201210212000_file.txt
201210222000_file.txt
201210192000_file.txt
201210202000_file.txt

How can I change this to sort it right?

Thanks in advance.


Viewing all articles
Browse latest Browse all 2562

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>