When you host your web site remotely and and the ftp server is the only way to upload all files including subdirectroies. You need to use special file transfer program such as ncftpget or ncftpput for recursive remote ftp server uploading and downloading purpose. Ncftp is considered as an improved FTP client. Ncftp’s improvements include support for command line editing, command histories, recursive gets/puts, automatic anonymous logins, and much more.

Install ncftp client

Type the following apt-get command under Debian / Ubuntu Linux to install ncftp client, run:
$ sudo apt-get install ncftp
Sample outputs:

Reading package lists... Done
Building dependency tree
Reading state information... Done
The following NEW packages will be installed:
0 upgraded, 1 newly installed, 0 to remove and 14 not upgraded.
Need to get 588 kB of archives.
After this operation, 1,307 kB of additional disk space will be used.
Get:1 http://debian.osuosl.org/debian/ squeeze/main ncftp amd64 2:3.2.4-1 [588 kB]
Fetched 588 kB in 2s (199 kB/s)
Selecting previously deselected package ncftp.
(Reading database ... 274906 files and directories currently installed.)
Unpacking ncftp (from .../ncftp_2%3a3.2.4-1_amd64.deb) ...
Processing triggers for menu ...
Processing triggers for man-db ...
Setting up ncftp (2:3.2.4-1) ...
update-alternatives: using /usr/bin/ncftp3 to provide /usr/bin/ncftp (ncftp) in auto mode.
Processing triggers for menu ...

If you are RHEL / CentOS / Fedora Linux user, type the following yum command to install ncftp client (first turn on EPEL repo):
# yum install ncftp

Syntax and examples

The syntax is as follows:

ncftpput ftp-host-name /path/to/remote/dir /path/to/local/dir
ncftpput -options ftp-host-name /path/to/remote/dir /path/to/local/dir

Try the ncftpput client command as follows:

ncftpput -R -v -u "username" ftp.nixcraft.biz /nixcraft/forum /tmp/phpbb


  • -u "username" : Ftp server username
  • -v : Verbose i.e. show upload progress
  • -R : Recursive mode; copy whole directory trees.
  • ftp.nixcraft.biz : Remote ftp server (use FQDN or IP).
  • /nixcraft/forum : Remote ftp server directory where all files and subdirectories will be uploaded.
  • /tmp/phpbb : Local directory (or list of files) to upload remote ftp server directory /nixcraft/forum

You can pass the password with -p option:

ncftpput -R -v -u "username" -p "passwordHere" ftp.nixcraft.biz /nixcraft/forum /tmp/phpbb

You can use port number 2021 instead of the default FTP service port # 21 as follows:

ncftpput -R -v -u "username" -p "passwordHere" -P 2021 ftp.nixcraft.biz /nixcraft/forum /tmp/phpbb
See also
  • See ftptreeupload.bash script to copy all files and subdirectories recursively and upload them to remote FTP server (copy local all directories/tree to remote ftp server).
  • ncftpput client can be downloaded from http://www.ncftp.com/ncftp/ and works with FreeBSD, Solaris and all most all UNIX like variant.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 10 comments so far... add one
CategoryList of Unix and Linux commands
Disk space analyzersncdu pydf
File Managementcat
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg jobs killall kill pidof pstree pwdx time
Searchinggrep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
10 comments… add one
  • SamTronik May 10, 2010 @ 16:03

    Thanks for this – saved me an age.

    Just for those who dont work it out themselves, you can not copy and paste the command line as the – (minus/dash) sign is not the correct type. You will need to replace them with a dash from your keyboard. Something to do with the way the web formats them I guess.

  • happy halloween Oct 30, 2010 @ 15:20

    Jupp, saved my day uploading 300GB of data to a new repository with only ftp available…
    Works fine with symbolic link in the filesystem.

  • vamsi krishna Dec 17, 2010 @ 18:18

    +1 for SamTronik, just type manually.
    -R -v -u and so on..

  • Avin Dec 9, 2011 @ 5:28

    Can we also provide password in same command ?
    If yes..How to do that ?

    I want to use this in my script.

    • Yassine Sedrani Sep 11, 2016 @ 17:36

      Yes you can with -p your_password

  • Lernen Jan 10, 2012 @ 14:59

    Hi, I am trying to upload a wordpress folder which contains some sub folders… but your command uploads everything in the root folder and is not creating any folders. …

  • Alan Jul 1, 2013 @ 20:02

    nixCraft, always helping me to solve problems!
    Thanks a lot!!!

  • James Dec 5, 2013 @ 3:38

    This doesn’t work when executed from Crontab or when the script is double-clicked in the File browser.

  • Dhavid Claudius Gunawan Aug 28, 2014 @ 12:54

    This post from 2005 really saved my day. Thank you 9 years old post.

  • Leszek Mar 17, 2016 @ 0:28

    You mean 11 years old Post 🙂

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum