I log into sftp:
sftp user@server
Then I run:
ls -lt
I expect files to be sorted by date.
sftp> ls -lt *.csv
-rw------- 0 76547986 200 5073032 Mar 14 08:42 file1.csv
-rw------- 0 76547986 200 5073032 Mar 15 08:41 file2.csv
-rw------- 0 76547986 200 5073032 Mar 16 08:41 file3.csv
-rw------- 0 76547986 200 5072802 Mar 17 08:42 file4.csv
-rw------- 0 76547986 200 1117736 Sep 30 14:44 file5.csv
-rw------- 0 76547986 200 1120419 Oct 2 08:45 file6.csv
-rw------- 0 76547986 200 1119763 Oct 1 08:43 file7.csv
-rw------- 0 76547986 200 5073258 Mar 13 08:41 file8.csv
But they are not.
Here is the version of OpenSSH
OpenSSH_7.2p2 Ubuntu-4ubuntu2.1, OpenSSL 1.0.2g 1 Mar 2016
Any idea why date sorting for ls in sftp is not working?
NOTE: ls -lt works in bash on the sftp server just not through sftp prompt. Maybe a bug in sftp?
ls -lt) but when * add a glob (ls -lt *.log) it breaks.*.do_globbed_ls) is completely different from the function for handling an ls without a glob (do_ls_dir). The glob function doesn't seem to have a sort. github.com/openssh/openssh-portable/blob/master/sftp.c#L1528sshfsand use normal utilities (bashls -ltand many more). Despite its name,sshfsdoesn't require full-blownsshaccess; it is reality intended to abstract the deficientsftpaway.