Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Using curl with an unpredictable target filename

Tags:

bash

curl

The filename of my curl download target is unpredictable and globbing with an asterisk isn't possible. I can download the file using the following command, but only after I've determined its' name in advance:

curl -O -vvv -k -u user:password https://myURL/ws/myfile.zip

How can I tailor my curl command to succeed with an unpredictable target name?

like image 245
David Dennis Avatar asked Oct 23 '25 19:10

David Dennis


1 Answers

There's no easy way to get a directory listing using HTTP. You can use curl to just print the HTML generated by the site. If there's an index with links to the files on that server, simply running

curl -s -u user:password https://myURL/ws/ | grep .zip

will print HTML-formatted links to the zip files available for download on that page.

like image 162
John Moon Avatar answered Oct 26 '25 08:10

John Moon