I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files.
If you can use scp
instead of ftp
, the -r
option will do this for you. I would check to see whether you can use a more modern file transfer mechanism than FTP.
Try mget:
mget remote-files
Expand the remote-files on the remote machine and do a get for each file name thus produced.
See glob for details on the filename expansion. Resulting file names will then be processed
according to case, ntrans, and nmap settings. Files are transferred into the local working
directory, which can be changed with ‘lcd directory’; new local directories can be created with
‘! mkdir directory’.
You might also need to switch off the prompt so it does not ask for every file (see the propmt command)
But using scp or rsync over ssh is probably better than ftp if you can.
You could rely on wget which usualy handles ftp get properly (at least in my own experience). I think it goes this way:
wget -r ftp://user:[email protected]/
Hope this helps!
If you can, I strongly suggest you tar
and bzip
(or gzip
, whatever floats your boat) the directory on the remote machine—for a directory of any significant size, the bandwidth savings will probably be worth the time to zip/unzip.
Use WGet instead. It supports HTTP and FTP protocols.
wget -r ftp://mydomain.com/mystuff
Good Luck!
reference: http://linux.about.com/od/commands/l/blcmdl1_wget.htm
There is 'ncftp' which is available for installation in linux. This works on the FTP protocol and can be used to download files and folders recursively. works on linux. Has been used and is working fine for recursive folder/file transfer.
Check this link... http://www.ncftp.com/
If you want to stick to command line FTP, you should try NcFTP. Then you can use get -R to recursively get a folder. You will also get completion.
FTP on Linux... if you're using the GNOME Desktop (or use Ubuntu), there is a GUI FTP client named GFTP (package gftp, requires packages gftp-gtk and gftp-text).
Package gftp has the following description--
X/GTK+ FTP client gFTP is a multithreaded FTP client. This version of it runs under X and was written using GLib/GTK+.
gFTP features:
* simultaneous downloads,
* resuming of interrupted file transfers,
* file transfer queues,
* downloading of entire directories,
* FTP and HTTP proxy support,
* remote directory caching, * passive and non-passive file transfers,
* drag-n-drop support,
* bookmarks menu, * support for SSH and SSH2 file transfers, * support FXP transfers, * stop button, and many more features.Author: Brian Masney
I drag-drop to my website, moving both install structures for apps (like Joomla) as well as PDF files that I share on my website. I have used the same tool to drag-drop from multi-directory FTP locations.
GFTP caches the directory structure and file names, and then steps through each directory and each file.
This is not a commandline solution, because different FTP servers support different commands, and scp isn't always available on the server that you're trying to download or upload to.
Peace.