4

I'm trying to use lftp to download all files from a remote ftp server to the local server in our multi-site enterprise that are older than a certain age and remove them from the remote server.

The command I'm trying is:

lftp -c "set ftp:list-options -a; set ftp:passive-mode false; open ftp://user:pass@host:port; cd '/path/'; mirror --older-than 30s --Remove-source-files --verbose"

The problem is I get the error: 30s: No such file or directory

Likewise with "--older-than now-5min"

Am I reading the man page wrong?

For the curious, here's why: I only want to grab the completed files from the remote server... I want "--older-than 30s" so it skips files that are still being written to.

1
  • If you question remains closed here, I'd recommend taking it over to linux.stackexchange.com .
    – 84104
    Apr 23, 2015 at 1:30

1 Answer 1

7

it should be

--older-than=now-5minutes

from man lftp

For options --newer-than and --older-than you can either specify a file or time specification like that used by at(1) command, e.g. now-7days' orweek ago'. If you specify a file, then modification time of that file will be used.

from man at:

You can also give times like now + count time-units, where the time-units can be minutes, hours, days, or weeks and you can tell at to run the job today by suffixing the time with today and to run the job tomorrow by suffixing the time with tomorrow.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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