How to Download Recursively from FTP at Command Line (mget and wget)

TerminalSometimes I want to download recursively from an FTP server and I don’t want to leave the command line. Depending on your FTP client, you may be lucky enough to have an option built-in for this but in many cases you don’t. FTP clients often feature mget, which is good for downloading files based on a glob filter such as *.txt or *.c. But still, this isn’t recursive.

Wget

Surprise! Wget supports FTP and can download recursively! You could download the full contents of an FTP server like this:

wget -r 'ftp://user:pass@host'

Or just grab a single directory like this:

wget -r 'ftp://user:pass@host/dir'

Cool, huh?