Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

...is 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 stackoverflow.com 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

1 Answer 1

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

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.