Problem
I’m trying to use the command line ftp client to ftp a folder, but I’ve only been able to use ‘get’ to download individual files so far.
Asked by Charles Ma
Solution #1
personal experience). Consider the following scenario:
wget -r ftp://user:pass@server.com/
You can also use the -m option, which is good for mirroring. -r -N -l inf is the current equivalent.
If your credential information contain any strange characters, you can use the —user and —password options to make it work. An example of a custom login with particular characters is as follows:
wget -r --user="user@login" --password="Pa$$wo|^D" ftp://server.com/
Even though -r is for recursion, it has a default max level of 5: as @asmaier pointed out.
Use the -m:mirroring option if you don’t want to miss out on subdirs.
Answered by Thibaut Barrère
Solution #2
I just wanted to add to Thibaut Barrère’s response.
I used
wget -r -nH --cut-dirs=5 -nc ftp://user:pass@server//absolute/path/to/directory
The double slash after the server name should be noted. If you don’t provide an extra slash, the path will be relative to the user’s home directory.
Answered by Ludovic Kuty
Solution #3
ncftp -u <user> -p <pass> <server>
ncftp> mget directory
Answered by Vinko Vrsalovic
Solution #4
Use mirror dir if you have lftp installed on your machine. Then you’re done. If you want to recursively download a directory, see Ciro’s comment below.
Answered by Dilawar
Solution #5
If you can use scp instead of ftp, the -r option will do this for you. I’d look into whether you can use something other than FTP to transmit files.
Answered by Greg Hewgill
Post is based on https://stackoverflow.com/questions/113886/how-to-recursively-download-a-folder-via-ftp-on-linux