?
Solved

How can I display latest files in sftp prompt

Posted on 2008-11-18
9
Medium Priority
?
490 Views
Last Modified: 2013-12-09
How can I display latest files in sftp prompt?

Like " ls -ltr " in unix shell
0
Comment
Question by:kitchas23
  • 4
  • 4
8 Comments
 
LVL 48

Expert Comment

by:Tintin
ID: 22987468
I think you can classify this as a SAQ (Self Answered Question)

At the sftp prompt, you can do

ls -lt

to list the files sorted by modification time.
0
 

Author Comment

by:kitchas23
ID: 22987704
No Tintin, it does not work.
$ sftp dtessh@twcos
Connecting to twcos...
sftp> ls -lt
Invalid flag -t
sftp>
0
 
LVL 48

Expert Comment

by:Tintin
ID: 22988138
Do you know what ssh client and server you have?

Is the -l flag supported in your version?
0
Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

 

Author Comment

by:kitchas23
ID: 22988217
ls -l is supported in my version
sftp> ls -l *BXERPT*
-rw-------    0 7533     200          4633 Nov 10 15:59 CMVN.11052008.155901.ARD.Failed
-rw-------    0 7533     200          4888 Nov 11 14:04 CMVN.11061986.095909.ARD.Failed
-rw-------    0 7533     200          5914 Nov 13 15:49 CMVN.11071986.115159.ARD.Failed
0
 
LVL 48

Expert Comment

by:Tintin
ID: 22988271
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"
0
 

Author Comment

by:kitchas23
ID: 22988529
sftp> version
SFTP protocol version 3
sftp>
0
 

Author Comment

by:kitchas23
ID: 22989387
No I can't. Its restricted only to use scp or sftp.
0
 
LVL 48

Accepted Solution

by:
Tintin earned 200 total points
ID: 22991251
If that's the case, then unfortunately, you'll have to issue the 'ls -l' in sftp, and then parse the output to get it into date order.
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
With the withdrawal of support for Windows Server 2003 this summer, many clients face the issue of moving away from their 2003 installs. There are a few options out there that many people/companies are selling. But the clients I have, haven't wanted…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Suggested Courses
Course of the Month16 days, 8 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question