这个问题似乎与 a specific programming problem, a software algorithm, or software tools primarily used by programmers 无关.如果您认为该问题将成为 another Stack Exchange site 上的主题,您可以发表评论,说明在哪里可以回答问题。
关闭8年前。
我正在尝试使用命令行 ftp 客户端对文件夹进行 ftp,但到目前为止,我只能使用“get”来获取单个文件。
最佳答案
您可以依赖 wget,它通常可以正确处理 ftp 获取(至少根据我自己的经验)。例如:
wget -r ftp://user:pass@server.com/
你也可以使用适合镜像的-m
。目前相当于-r -N -l inf
。
如果您在凭证详细信息中有一些特殊字符,您可以指定 --user
和 --password
参数以使其工作。带有特定字符的自定义登录示例:
wget -r --user="user@login" --password="Pa$$wo|^D" ftp://server.com/
正如@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.
如果你不想错过子目录,最好使用镜像选项,-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.
https://stackoverflow.com/questions/113886/