HostOnNet Blog

How to move site files using lftp

lftp

lftp is a command line ftp client, that can be used to upload files and folders. Default ftp command available on linux systems can only upload files from same directory, can’t handle sub folders.

Lets say, we need to upload content of site “MY-SITE.com” to new server – server76.hosthat.com

In SSH, change to the site folder.

cd /home/domains/MY-SITE.com/wwwroot

Lets connect to remote server with lftp

lftp -d -u FTP_USER_NAME_HERE server76.hosthat.com

We have to change to wwwroot folder.

cd MY-SITE.com/wwwroot

To make sure you are in correct folder, use ls or dir command to list content of directory.

If we are in correct folder (wwwroot), then we can run command mirror -R to upload content of current directory to remote directory. Mirror means download, with -R open, we are reverse mirroring, that is upload.

mirror -R

Again, verify files are uploaded with ls or dir command.

Disconnect from remote FTP server with command

bye

You should make sure you are in correct local and remote directory before mirroring.

Here is example of moving web site imsmatha.org

cd /home/domains/imsmatha.org/wwwroot
lftp -d -u imsmatha.org server76.hosthat.com
> WILL ASP PASSWORD
cd imsmatha.org/wwwroot
rm default.aspx 
mirror -R
bye

Posted in CentOS