Take the 2-minute tour ×
Ask Different is a question and answer site for power users of Apple hardware and software. It's 100% free, no registration required.

How do I download a whole folder through FTP in Terminal?

share|improve this question

4 Answers 4

up vote 4 down vote accepted

mget is the closest you can get with the included FTP binary. You have to mkdir and cd/lcd and then get all the files than match a pattern like *

The prompt toggle may come in handy.

FTP works within a directory, not on directories as containers of files. If you absolutely had to get the job done and ftp was the only tool you could use - you could cobble together an expect script to drive ftp for you.

Thankfully there are alternatives like scp|rsync|wget to get whole directories worth of files.

share|improve this answer
    
Ok...so the bottom line is that I can't download a whole folder at one time; I have to download the individual files, right? –  daviesgeek Jul 22 '11 at 15:23
    
Yup. Everyone wouldn't be showing wget, sftp, scp and rsync if ftp were up to the task. –  bmike Jul 22 '11 at 15:41
    
Thanks...does SFTP allow folder downloading? –  daviesgeek Jul 22 '11 at 16:07
    
Oops (sorry) - no. sftp is the same syntax and limitations of ftp - just securing the connection using ssh instead of ftp authentication. –  bmike Jul 22 '11 at 16:47
    
Ok...thank you very much!! –  daviesgeek Jul 22 '11 at 17:17

follow this instruction :

type

ftp

then you are in ftp looking like

ftp>

then you open ip of server

ftp> open xx.xxx.xxx.xx

then it will ask for username, you will provide

Name:(your ftp server): your_username

then it wil ask for password

Password:  your_password

then you should be logged in and see the ftp> shell again, you can type "ls" to list all files and you can navigate like in inix with cd

when you found your filename you can download it with

ftp> get filename

et voila, the file will be downloaded to the directory you opened shell localy from

you cant download directorys, but you could navigate into your directory and download multiple e.g all files

Task: Download Multiple Files

You need to use mget command as follows to copy multiple files from the remote ftp server to the local system. You may be prompted for a yes/no (Y/N) answer before transferring each file (you can disable prompt by passing the -i option to ftp client). To download all files, enter: ftp> mget *

information from http://www.cyberciti.biz/faq/linux-unix-ftp-commands/ cheers

share|improve this answer

Another way is to use curl

curl ftp://ftp.com/mp3/* --user login:password -o /myfolder/*

I think this is working, or file by file

curl ftp://ftp.com/mp3/mymusic.zip --user login:password -o mymusic.zip

I hope this helped.

share|improve this answer
    
OK, thank you very much, but is there a way via FTP to do this? –  daviesgeek Jul 21 '11 at 23:28
    
Awesome! I was unaware of curl's FTP proclivity. Thanks! –  bmike Jul 22 '11 at 1:24
    
Yeah...neither was I. I'll probably use it more often. –  daviesgeek Jul 22 '11 at 15:24

Use scp (documentation) or sftp (documentation)

scp -r mylocaldirectory login@myserverip:/remote/directory/path/
share|improve this answer
    
That's not what I'm asking. My question is: How do I download a folder via FTP in Terminal? In other words, what commands in FTP do I use to download a folder? –  daviesgeek Jul 21 '11 at 21:58
2  
sftp is far superior to FTP +1 –  bmike Jul 22 '11 at 1:23

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.