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
Reading package lists... Done Building dependency tree Reading state information... Done The following NEW packages will be installed: ncftp 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 ...
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 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.