`ls -t` sorts files by mtime (youngest first), and `ls -r` reverses the sort order, so both `var=$(ssh $remote "ls -t | tail -n 1")` or `var=$(ssh $remote "ls -tr | head -n 1")` should work.
`ls -t` sorts files by mtime (youngest first), and `ls -r` reverses the sort order, so both `var=$(ssh $remote "ls -t | tail -n 1")` or `var=$(ssh $remote "ls -tr | head -n 1")` should work.