Linux

FTP with Recursive Download (Directory Download)

My office mate was copying files from server A to server B. To do that, he needs to download the files which is approximately 500MB to his dev machine and upload to server B. To help him, I suggest downloading the files via ssh at server B.

So here it is:

We have this directory in server A: /var/www/html/ -> the files inside.
To transfer them, we must login to server B via ssh. At the promt:

su
cd mkdir ~/data
cd ~/data
wget -r ftp://userName:thePass@serverA//var/www/html/*

wget is a linux utility that helps us download files usually directories easily.
To copy the files to the server B’s web document root, assuming the all files inside html are all needed, we simply copy it by:

cp -R ~/data/serverA/var/www/html/* /var/www/html/

The -R option means recursive. For the cp command, it means to copy recursively if it has directories on it.

2 thoughts on “FTP with Recursive Download (Directory Download)”

Leave a reply

Your email address will not be published. Required fields are marked *