我正在尝试使用命令行ftp客户端ftp文件夹,但到目前为止,我只能使用'get'获取单个文件。
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.
最满意答案
你可以依靠通常处理ftp的wget(至少在我自己的经验中)。 例如:
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.
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.
更多推荐
发布评论