如何在Linux上通过FTP递归下载文件夹[关闭]

本文翻译自:How to recursively download a folder via FTP on Linux [closed]

我正在尝试使用命令行ftp client ftp文件夹,但到目前为止我只能使用'get'来获取单个文件。


#1楼

参考:https://stackoom.com/question/Tcs/如何在Linux上通过FTP递归下载文件夹-关闭


#2楼

If you can use scp instead of ftp , the -r option will do this for you. 如果您可以使用scp而不是ftp-r选项将为您执行此操作。 I would check to see whether you can use a more modern file transfer mechanism than FTP. 我会检查你是否可以使用比FTP更现代的文件传输机制。


#3楼

You could rely on wget which usually handles ftp get properly (at least in my own experience). 你可以依赖通常处理ftp的wget得到正确的(至少在我自己的经验中)。 For example: 例如:

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

You can also use -m which is suitable for mirroring. 您也可以使用适合镜像的-m It is currently equivalent to -r -N -l inf . 它目前相当于-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. 如果凭证详细信息中有一些特殊字符,则可以指定--user--password参数以使其起作用。 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: 编辑正如@asmaier所指出的那样,注意即使-r用于递归,它的默认最大级别为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

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

#4楼

ncftp -u <user> -p <pass> <server>
ncftp> mget directory

#5楼

如果可以,我强烈建议您使用tarbzip (或gzip ,无论你的船是什么漂浮)远程机器上的目录 - 对于任何大小的目录,带宽节省可能值得拉链/解压缩的时间。


#6楼

Use WGet instead. 请改用WGet。 It supports HTTP and FTP protocols. 它支持HTTP和FTP协议。

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

Good Luck! 祝好运!

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

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值