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.