Tell me more ×
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

3 Answers

up vote 3 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

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
1  
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.