Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Download and delete remote files using lftp

Tags:

lftp

I can't figure out how to download AND delete remote files using lftp using the command line only.

Using bash is also OK.

What are the flags and the full command line? All I can figure out is the mirror command, but that leaves files on the remote server.

like image 866
John Avatar asked May 11 '13 21:05

John


1 Answers

Finally figured it out... use the flag "--Remove-source-files" with mirror and all is well.

Like this:

lftp sftp://${username}@${host} -u ${username},${password} -e "mirror --Remove-source-files --verbose ${remote_dir} ${local_dir}; bye"
like image 72
John Avatar answered Oct 17 '22 01:10

John