简体   繁体   English

我如何 curl URL 最后一个未知的文件名?

[英]How do I curl a URL with an unknown filename at the end?

I'm talking to a server that creates a new zip file daily, ex: (data-1234.zip).我正在与每天创建一个新的 zip 文件的服务器通信,例如:(data-1234.zip)。 Every day the name of the previous zip is removed and a new one is created with an incremented number, ex: (data-1235.zip).每天都会删除以前的 zip 的名称,并创建一个新的名称,其编号递增,例如:(data-1235.zip)。 The script will be run sporadically throughout the week but it's on a lab system where the user can't manually update the name with what's on the server.该脚本将在一周内偶尔运行,但它位于实验室系统上,用户无法使用服务器上的内容手动更新名称。

The server only has one zip file in that directory, it's just a matter of getting the correct naming convention.服务器在该目录中只有一个 zip 文件,这只是获得正确命名约定的问题。 There is, however a "data.ini" file in the folder as well, so something just searching by first name wouldn't necessarily work.但是,文件夹中也有一个“data.ini”文件,因此仅按名字搜索不一定有效。 I've seen posts similar to This question using regex but the file is currently on 10,609 and I'd rather not use expansion for potentially thousands of calls depending on access to modify the script in the coming years.我看到过类似于This question using regex的帖子,但该文件当前位于 10,609 上,我宁愿不对可能的数千个调用使用扩展,具体取决于未来几年修改脚本的访问权限。 I've been searching for something similar to "data-*.zip" but haven't had any luck.我一直在寻找类似于“data-*.zip”的东西,但一直没有找到。

Question was solved by changing commands and running lftp https://download.companyname.com/product/data/ -e "mget data-*.zip; bye" since lftp allows wildcards in the filename, unlike curl.通过更改命令并运行lftp https://download.companyname.com/product/data/ -e "mget data-*.zip; bye"解决了问题,因为 lftp 允许在文件名中使用通配符,这与 curl 不同。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM