I am using $file = dir *.txt | sort LastWriteTime -Descending | select -First 1 to try and get the most recent text file in a folder, this works as long as all
$file = dir *.txt | sort LastWriteTime -Descending | select -First 1