Home > Mobile >  How do I curl a URL with an unknown filename at the end?
How do I curl a URL with an unknown filename at the end?

Time:02-05

I'm talking to a server that creates a new zip file daily, ex: (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). 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. There is, however a "data.ini" file in the folder as well, so something just searching by first name wouldn't necessarily work. 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. I've been searching for something similar to "data-*.zip" but haven't had any luck.

CodePudding user response:

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.

  • Related