Mirror Website Directory Over FTP

(0 votes, average 0 out of 5)

You can easily mirror the contents of a directory over FTP using the lftp program on Linux. To connect, create a configuration file for lftp that specifies the credentials for the ftp server, the directory on the remote ftp server that you want to download files from, and where you want to place them on the local machine:

1
2
3
4
5
6
set ftp:anon-user "ftpusername"
set ftp:anon-pass "ftppassword"
set ftp:ssl-allow no
open remote-ftp-server.com
mirror -c /remote/directory/ /local/directory/to/put/files/in
exit

Save this script on your local machine, e.g. /tmp/ftp-mirror . Now, run lftp in a screen session in order to make sure that the transfer continues even if you get disconnected:

1
2
screen
lftp -f /tmp/ftp-mirror

Your file transfer will start and once completed you will have a local mirror of all of the files on your ftp server.

Partner Links:
 
Related Articles

» How to Move (or 'Cut and Paste') a File in Linux

Moving a file in linux is as easy as using the mv command:mv filename.txt foo/bar/newname.txtThe command above would move a file named filename.txt into the bar directory with a new name (newname.txt). If you only specify the directory, the name of the file will not change.

» Matplotlib IOError: Error While Writing to Output Stream

When using the Python Matplotlib library, Python may throw the following error:1IOError: error while writing to output streamCommonly this is caused because Python does not have access to the output stream -- in this case, usually some file that Matplotlib is attempting to write to.  This is typical when the Python script is being used on a web server.  For instance, the following code might not work if the directory "output" does not have write permissions on a...

» Using Cookies to Save Data in PHP

Cookies are a useful way to save information, for example a user preference or login session locally on the client's machine. PHP makes creating and accessing cookies very easy. To create a cookie called myCookie with the value hello,world, simply add the following line of PHP code:$expireTime = 60 * 60 * 24 + (); // 1 day("myCookie", "hello,world", $expireTime); This data will then be available the next time the user loads that particular page. To access the cookie at a later date, use the...