Lftp mirror01 Sep 2015
The FTP File Transfer Protocol protocol is quite old. It was created in 1971 and changed in 1972 which was closed to modern version.
Development of the Internet endangered using FTP cause of the security weakness. Anyway this protocol is still usable in some production areas like WEB design, Post production, etc. As for me I prefer to stay away from FTP and prefer the modern secured protocols, but in some cases I have to use it for a while.
As a UNIX geek I prefer to use the terminal based applications. For FTP protocol the
lftp program is a good choice.
Just recently I learned that there exists a function
mirror there which gives ability to mirror files and directories from the remote FTP server. To work with it is very simple:
The generic syntax in
lftp interactive mode:
-c, –continue continue a mirror job if possible;
-R, –reverse reverse mirror (put files);
-P, –parallel[=N] download N files in parallel;
-n, –only-newer download only newer files (-c won’t work)
First, you need to connect to the remote FTP server using the following syntax:
To mirror all of the above files in the current directory, enter:
I highly recommend that you start mirror job with resume option. This make sure if FTP mirror was failed due to network connection it will only download partial file:
To download only newer files (-c won’t work):
You can speed up FTP mirror operation by downloading files in parallel using the following syntax:
You need to pass
--reverse option to do reverse mirror i.e. put all files from a local disk to a remote FTP server including sub-dirs and all files in it:
Thanks for your attention.