How to recursively download a folder via FTP on Li

2019-01-09 21:21发布

I'm trying to ftp a folder using the command line ftp client, but so far I've only been able to use 'get' to get individual files.

12条回答
姐就是有狂的资本
2楼-- · 2019-01-09 21:45

wget -r ftp://url

Work perfectly for Redhat and Ubuntu

查看更多
不美不萌又怎样
3楼-- · 2019-01-09 21:46

Use WGet instead. It supports HTTP and FTP protocols.

wget -r ftp://mydomain.com/mystuff

Good Luck!

reference: http://linux.about.com/od/commands/l/blcmdl1_wget.htm

查看更多
孤傲高冷的网名
4楼-- · 2019-01-09 21:50

toggle the prompt by PROMPT command.

Usage:

ftp>cd /to/directory    
ftp>prompt    
ftp>mget  *
查看更多
狗以群分
5楼-- · 2019-01-09 21:51

You could rely on wget which usually handles ftp get properly (at least in my own experience). For example:

wget -r ftp://user:pass@server.com/

You can also use -m which is suitable for mirroring. It is currently equivalent to -r -N -l inf.

If you've some special characters in the credential details, you can specify the --user and --password arguments to get it to work. Example with custom login with specific characters:

wget -r --user="user@login" --password="Pa$$wo|^D" ftp://server.com/

EDIT As pointed out by @asmaier, watch out that even if -r is for recursion, it has a default max level of 5:

       -r
       --recursive
           Turn on recursive retrieving.

       -l depth
       --level=depth
           Specify recursion maximum depth level depth.  The default maximum depth is 5.

If you don't want to miss out subdirs, better use the mirroring option, -m:

       -m
       --mirror
           Turn on options suitable for mirroring.  This option turns on recursion and time-stamping, sets infinite
           recursion depth and keeps FTP directory listings.  It is currently equivalent to -r -N -l inf
           --no-remove-listing.
查看更多
一纸荒年 Trace。
6楼-- · 2019-01-09 21:52

There is 'ncftp' which is available for installation in linux. This works on the FTP protocol and can be used to download files and folders recursively. works on linux. Has been used and is working fine for recursive folder/file transfer.

Check this link... http://www.ncftp.com/

查看更多
仙女界的扛把子
7楼-- · 2019-01-09 21:55
ncftp -u <user> -p <pass> <server>
ncftp> mget directory
查看更多
登录 后发表回答