Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. 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 need to transfer a large number of files from an FTP server to a new server. There could be thousands of files so I would like to limit it to files that were uploaded in the last three months - is that possible and if so how?

Also is it possible to find out how big the download is likely to be before you start the actually download?


share|improve this question
up vote 2 down vote accepted

You can use lftp for that, utilizing its mirror command. Here's a snip from the manpage:

  mirror [OPTS] [source [target]]

   Mirror specified source directory to local target directory. If target
   directory  ends  with  a  slash,  the source base name is appended to 
   target directory name. Source and/or target can be URLs pointing to 

        -N, --newer-than=SPEC    download only files newer than specified time
            --on-change=CMD      execute the command if anything has been changed
            --older-than=SPEC    download only files older than specified time

Definitely have a look at the manual, as there are really many useful options to mirror - like --allow-chown, --allow-suid or --parallel[=N] for example. Lftp also works with other access protocols, like sftp, fish or http(s).

share|improve this answer
Perfect. Thanks! – williamsdb Mar 27 '12 at 11:51

You could try mounting it as a filesystem using curlftpfs.
Then copy using find.

mkdir /tmp/mountpoint
curlftpfs ftp://example.com/ /tmp/mountpoint/
cd /tmp/mountpoint
find -mtime +90 -exec cp {} /dest/path/ \;

I suspect better solutions exist.

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.