Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm interested in listing remote files (with names matching a pattern) by date, and storing this list locally. The various things I've tried follow:

ls -t SL*.txt interpreted as a request to output to a local file named SL*.txt.

ls SL*.txt local_out.txt

...behaves correctly but without the desired sorting behavior.

ls -t SL*.txt local_out.txt

...results in an error:

usage: ls remote-directory local-file

How can I get a time-sorted remote directory list, filtered for only matching content, saved to a file?

share|improve this question

migrated from May 10 '12 at 4:00

This question came from our site for professional and enthusiast programmers.

Not a programming question. – unwind May 9 '12 at 12:30
-t is not an available flag to the FTP ls command (which is not the same as just running the shell ls command remotely). – Charles Duffy May 9 '12 at 12:31
up vote 4 down vote accepted

Your assumption that ls command over ftp is somehow related to the shell ls command is incorrect: when you type ls ... into ftp window, the command gets interpreted by the ftp server on the other side, and it may not be even running UNIX, and know nothing about ls command and the switches that it supports. The s remote-directory local-file is the only syntax available; there is no place to enter switches.

share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .