kitchas23
asked on
How can I display latest files in sftp prompt
How can I display latest files in sftp prompt?
Like " ls -ltr " in unix shell
Like " ls -ltr " in unix shell
ASKER
No Tintin, it does not work.
$ sftp dtessh@twcos
Connecting to twcos...
sftp> ls -lt
Invalid flag -t
sftp>
$ sftp dtessh@twcos
Connecting to twcos...
sftp> ls -lt
Invalid flag -t
sftp>
Do you know what ssh client and server you have?
Is the -l flag supported in your version?
Is the -l flag supported in your version?
ASKER
ls -l is supported in my version
sftp> ls -l *BXERPT*
-rw------- 0 7533 200 4633 Nov 10 15:59 CMVN.11052008.155901.ARD.F ailed
-rw------- 0 7533 200 4888 Nov 11 14:04 CMVN.11061986.095909.ARD.F ailed
-rw------- 0 7533 200 5914 Nov 13 15:49 CMVN.11071986.115159.ARD.F ailed
sftp> ls -l *BXERPT*
-rw------- 0 7533 200 4633 Nov 10 15:59 CMVN.11052008.155901.ARD.F
-rw------- 0 7533 200 4888 Nov 11 14:04 CMVN.11061986.095909.ARD.F
-rw------- 0 7533 200 5914 Nov 13 15:49 CMVN.11071986.115159.ARD.F
OK, I'm guessing you either have an older ssh client or server.
I'm assuming you want to script this? If so, I find sftp is not the best tool for scripting. It's much better suited to interactive use.
Do you have standard ssh/scp access? If so, then you could do
ssh dtessh@twcos "ls -lt"
I'm assuming you want to script this? If so, I find sftp is not the best tool for scripting. It's much better suited to interactive use.
Do you have standard ssh/scp access? If so, then you could do
ssh dtessh@twcos "ls -lt"
ASKER
sftp> version
SFTP protocol version 3
sftp>
SFTP protocol version 3
sftp>
ASKER
No I can't. Its restricted only to use scp or sftp.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
At the sftp prompt, you can do
ls -lt
to list the files sorted by modification time.