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

6 Answers 6


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.

  • 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, 2011 at 15:23
  • Yup. Everyone wouldn't be showing wget, sftp, scp and rsync if ftp were up to the task.
    – bmike
    Jul 22, 2011 at 15:41
  • Thanks...does SFTP allow folder downloading?
    – daviesgeek
    Jul 22, 2011 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, 2011 at 16:47
  • If you're bound to the FTP protocol you can use lftp to do a recursive download of a directory tree. Old school solution to this problem.
    – Ian C.
    Dec 1, 2013 at 4:32

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.

  • OK, thank you very much, but is there a way via FTP to do this?
    – daviesgeek
    Jul 21, 2011 at 23:28
  • Awesome! I was unaware of curl's FTP proclivity. Thanks!
    – bmike
    Jul 22, 2011 at 1:24
  • Yeah...neither was I. I'll probably use it more often.
    – daviesgeek
    Jul 22, 2011 at 15:24
  • 3
    I'm trying your suggestion but getting this: curl: (78) RETR response: 550
    – Omer
    Oct 5, 2016 at 5:32
  • 1
    curl absolutely cannot handle this. wget can.
    – Ken Sharp
    Jul 1, 2017 at 18:42

Use scp (documentation) or sftp (documentation)

scp -r login@myserverip:/remote/directory/path/ mylocaldirectory
  • 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, 2011 at 21:58
  • 2
    sftp is far superior to FTP +1
    – bmike
    Jul 22, 2011 at 1:23
  • 1
    @bmike: yes, but older ftp servers may not support sftp.
    – PLL
    Mar 18, 2016 at 17:05
  • Both links are dead :(
    – xarlymg89
    Jun 24, 2021 at 11:44

I had to download 22'000+ webcam pictures from my web server, which is a bit of a challenge for both the Finder and my FTP program CyberDuck.

So I did the following (based on @bmike's answer):

mkdir ~/Desktop/image-dump-myserver
ftp ftp://myuser@myserver.com
# enter password

# You're now in the ftp console (where the world is still okay)

# Set the local folder
lcd ~/Desktop/image-dump-myserver

# cd into the desired folder (`ls`, `pwd` etc. all work here)
cd /httpdocs/images

# Toggle the interactive mode

# Download the desired files (all the images in my case)
mget *.jpg

Then the files are being downloaded into the desired folder:

local: image1433509292_1582.jpg remote: image1433509292_1582.jpg  
229 Entering Extended Passive Mode (|||50001|)  
150 Opening BINARY mode data connection for image1433509292_1582.jpg (63626 bytes)  
100% |***********************************| 63626        1.51 MiB/s    00:00 ETA  
226 Transfer complete  
63626 bytes received in 00:00 (0.98 MiB/s)  

local: image1427279963_0841.jpg remote: image1427279963_0841.jpg  
229 Entering Extended Passive Mode (|||50053|)  
150 Opening BINARY mode data connection for image1427279963_0841.jpg (67194 bytes)  
100% |***********************************| 67194        1.64 MiB/s    00:00 ETA  
226 Transfer complete  
67194 bytes received in 00:00 (1.04 MiB/s) 

local: image1439798493_1783.jpg remote: image1439798493_1783.jpg  
229 Entering Extended Passive Mode (|||50357|)  
150 Opening BINARY mode data connection for image1439798493_1783.jpg (48876 bytes)  
100% |***********************************| 48876        1.80 MiB/s    00:00 ETA  
226 Transfer complete  
48876 bytes received in 00:00 (996.81 KiB/s)  

I am using

wget -r -l 10 --ftp-user='FTP_USER' --ftp-password='FTP_PASSWORD' \

Unfortunately wget doesn't support parallel downloads.


follow this instruction :



then you are in ftp looking like


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

  • The ftp unix tool has been removed from OS X (in Sierra, I think?).
    – benwiggy
    Aug 30, 2019 at 7:29

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .