Linux.com

Feature

Upload directories recursively with NcFTP

By Peter Leung on March 14, 2006 (8:00:00 AM)

Share    Print    Comments   

I recently had to upload some content to a Web site, and the only access available was via FTP. I needed an FTP client capable of uploading a directory structure recursively. I found what I needed in an application called NcFTP.

I started by looking into Mozilla Firefox, but to my surprise, Firefox supports only FTP downloads, not uploads. Mozilla, on the other hand, does support uploads, but it can upload only one file at a time.

Next, I turned to command-line FTP clients. Again, the standard FTP command doesn't support recursive directory upload. Fortunately, many graphical and command-line FTP clients do, including NcFTP, yafc, and LFTP. I picked NcFTP.

After installing the software, connect to your host anonymously by entering the ncftp command followed by the hostname:

ncftp ftp.somedomain.com

or if you need to log in with a valid username, use the -u and -p parameters:

ncftp -u username -p password ftp.somedomain.com

A successful connection puts you in an NcFTP shell. If you've used the standard FTP command before, you should feel right at home here. I'll presume you're familiar with basic FTP commands such as dir and cd. You can use the lls and the lcd commands to list and navigate the local working directory.

NcFTP supports autocompletion for both commands and filenames. For instance, you can type in the first few characters of a filename and then press Tab to fill in the rest of the name automatically.

Recall that my main goal was to upload a directory structure. Use the put -R command to do a recursive directory upload:

ncftp /path > put -R somedir

Standard FTP also supports a put command, but it's limited to uploading single files.

Similarly, you can download a directory recursively using the NcFTP get -R command:

ncftp /path > get -R somedir

More handy features

If you FTP to the same sites regularly, you can save time by using NcFTP's bookmark feature. Bookmarks store the connection information, including the username, the password, the hostname, and the target directory location.

To create a bookmark on a particular directory location, first navigate to that directory and then enter the bookmark command followed by a name to identify the bookmark. For example, type these commands to bookmark /path/somedir and name it topsecret:

ncftp /path > cd somedir
ncftp /path/somedir > bookmark topsecret

A bookmark editor lets you open, edit, delete, replicate, and add bookmarks. Invoke the editor by entering the bookmarks command with no parameters:

ncftp /path > bookmarks

Once you create a bookmark, you can connect to the corresponding host and directory quickly by using the bookmark name. Login is automatic because the bookmark stores the username and password.

For instance, you can connect using a bookmark named topsecret by entering this command in the Linux shell:

ncftp topsecret

Alternatively, you can open a connection while inside the NcFTP shell:

ncftp> open topsecret

Wrapping it up

File Transfer Protocol (FTP) was once a commonly used method for transferring files over the Internet, but recent security concerns have lessened its use in favor of the more secure SSH File Transfer Protocol (SFTP) or Secure Copy (SCP). Nevertheless, FTP may be the only access available to you on occasion.

NcFTP is loaded with useful features. I've touched on only the basics. If you ever require an FTP client more powerful than the standard FTP command, consider NcFTP.

Share    Print    Comments   

Comments

on Upload directories recursively with NcFTP

Note: Comments are owned by the poster. We are not responsible for their content.

NcFTP seriously outmoded

Posted by: Anonymous Coward on March 14, 2006 09:09 PM
The 1990s called, and they want their ftp client back.

NcFTP isn't very well maintained, and has been completely eclisped by the feature set and qauality of lftp. If you want a fancy ftp client, look no further than lftp.

--k8to

#

Even better, for CLI users

Posted by: Anonymous Coward on March 14, 2006 10:07 PM
For CLI users NcFTP comes with NcFTPput and NcFTPget which allow command line FTP transfers. Both NcFTPput and NcFTPget allow directory recursion. It is very easy to use and script command line FTP transfers. Just what is needed for moving files between local computers or a home server. Check them out through their man pages.

#

Re:Even better, for CLI users

Posted by: Anonymous Coward on March 18, 2006 12:58 AM
I recommand ckermit (Unix) and kermit-95 (Windows). Except supporting of serial line protocol like Kermit, X/Y/Z modem, it has built-in support of IP based protocols, like ftp, telnet, sftp, ssh and those I can't remember. You can create symbolic link with name of ftp, telnet and run ckermit with ftp or telnet personality.

It's fully scriptable with construction such as IF, WHILE, FOR. It has pty and redirect support. It even has proper support of regular expression for string processing.

Its powerfull CLI interface has auto command completion and built-in help for each command. The only shortcoming is its lack of Bash like command line editing (you can recall previous commands, but you can't edit it in any other way except backspacing).

It's also my rescue tool since it can be put on both end of an RS-232 line for debuging when everything is not working. You can use the line to edit Grub entry on air. You can transfer in a new kerenl tarball in reliable 115200 bps speed.

With 'screen, 'mc' (or emacs), and 'ckermit', you really don't need anything else to survive in a CLI-only environment.

#

Midnight Commander!

Posted by: Anonymous Coward on March 14, 2006 11:36 PM
Midnight Commander has everything I need. including ftp and of course ssh

#

Re:Use SCP!! PLEASE!!!

Posted by: Anonymous Coward on March 15, 2006 02:58 AM
I would... and usually do... except finding a web host that actually allows ssh access to shared servers is pretty difficult.

For some reason the hosts think the ssh is the security hole (not ftp?!) and aren't prepared to muck around with their configs to allow scp or sftp without shell access in case it might break their ensim config. (tail wags dog)

#

Re:Use SCP!! PLEASE!!!

Posted by: Administrator on March 15, 2006 03:34 AM
Sorry to toot my own horn, but try suso.org. We actually have a clue. We've actually all but turned off ftp because its not safe to use.

#

sitecopy

Posted by: Anonymous Coward on March 17, 2006 08:02 PM
I have used sitecopy for some time now to do this: functionality like rsync (up and down) but uses ftp.

<a href="http://www.lyra.org/sitecopy/" title="lyra.org">http://www.lyra.org/sitecopy/</a lyra.org>

#

Use SCP!! PLEASE!!!

Posted by: Administrator on March 14, 2006 09:45 PM
Please stop using ftp. It is an outdated and mostly cleartext protocol. Please use SCP instead and support those hosting providers that provide SSH/SCP access. Boycot those that don't. There are enough SCP clients (including graphical ones) on every platform that its not a problem anymore.

#

thanks for the feedback

Posted by: Administrator on March 18, 2006 12:59 AM
Thanks for all the suggestions of tools that you use.

Peter Leung

#

This story has been archived. Comments can no longer be posted.



 
Tableless layout Validate XHTML 1.0 Strict Validate CSS Powered by Xaraya