使用通配符从 https url 下载文件并进行身份验证
Download file from https url with authentication using wildcards
我需要使用命令行从 Nexus 存储库下载工件。工件文件名未知,但扩展名始终为 *.zip
。我正在使用带有通配符的 curl 命令。当我执行命令时,它说 HTTP/1.1 404 Not Found
curl --insecure -O -u username:password -v https://nexus.internal.org.com/content/repositories/snapshots/com/org/artifact/1.4.0/*.zip
> Accept: */*
>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0< HTTP/1.1 404 Not Found
< Accept-Ranges: bytes
< Content-Type: text/html
< Date: Wed, 01 Mar 2017 22:28:35 GMT
< Server: Nexus/2.14.2-01
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< transfer-encoding: chunked
< Connection: keep-alive
该文件实际存在于 URL 位置。我运行的命令可以吗?
我根据 的说明找到了一个很好的方法
基本上请求整个前缀的内容,在递归中设置一些边界并通过类似 shell 的模式过滤接受的文件。
如果我没记错的话,执行您想要的操作的命令是:
wget --recursive --level=1 --no-parent --no-directories \
--accept '*.zip' \
--directory-prefix=. \
https://nexus.internal.org.com/content/repositories/snapshots/com/org/artifact/1.4.0/
我需要使用命令行从 Nexus 存储库下载工件。工件文件名未知,但扩展名始终为 *.zip
。我正在使用带有通配符的 curl 命令。当我执行命令时,它说 HTTP/1.1 404 Not Found
curl --insecure -O -u username:password -v https://nexus.internal.org.com/content/repositories/snapshots/com/org/artifact/1.4.0/*.zip
> Accept: */*
>
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0< HTTP/1.1 404 Not Found
< Accept-Ranges: bytes
< Content-Type: text/html
< Date: Wed, 01 Mar 2017 22:28:35 GMT
< Server: Nexus/2.14.2-01
< X-Content-Type-Options: nosniff
< X-Frame-Options: SAMEORIGIN
< transfer-encoding: chunked
< Connection: keep-alive
该文件实际存在于 URL 位置。我运行的命令可以吗?
我根据
如果我没记错的话,执行您想要的操作的命令是:
wget --recursive --level=1 --no-parent --no-directories \
--accept '*.zip' \
--directory-prefix=. \
https://nexus.internal.org.com/content/repositories/snapshots/com/org/artifact/1.4.0/