Uploading / Downloading folders using ftp cmd

Since the default ftp command line client tool don’t have the option to upload or download folder directly from ftp cmd due to ftp socket based server restriction. Here is a short and tricky tutorial which helps you to download / upload folder directly without any hassle and this is especially very usefully if you want to copy the accounts from another server to your server and if you don’t have any other access except ftp.




lftp is a file transfer program that allows sophisticated ftp, http and other connections to other hosts. If site is specified then  lftp  will connect  to that site otherwise a connection has to be established with the open command. I have covered a full tutorial about how to install and work with lftp here


Downloading a folder


Once you installed the lftp, just use the mirroring feature in the lftp cmd to download the folder from your ftp account to your local harddrive or to any path. (For example if your ftp host name is ftp.gnutoolbox.com ). Use the following command to connect with your ftp server.


  • # lftp -u username,yourpassword ftp.gnutoolbox.com


You will see a command line prompt something similar to below.



If you want to download the folder name public_html from ftp server to /home/backup in your pc or server for example. Use from the lftp command prompt

  • mirror -c -e public_html /home/backup

And once the process is over, just check the /home/backup folder to list all the files.


Uploading a folder


Similar to downloading, you can use the mirror -R command option to upload or mirror a folder from your local drive to the remote ftp server or account, use from the lftp command prompt


  • mirror -c -e -R /local/path /remote/path


For more help type ” help mirror ” from the lftp cmd line.