I need to download a few files from a web server using cURL, such as:
curl.exe "http://myserver.com/{file1.ext,file2.ext,my%20file%20with%20spaces.ext}" -o "C:myfolder#1"
This works fine, except for the fact that it writes in my local filesystem "my%20file%20with%20spaces.ext", instead of desired "my file with spaces.ext" file name.
If I remove %20 from the URL it obviously returns an error:
curl: (22) The requested URL returned error: 404 Not Found
The list of files being "globbed" (as seen in the example above) is not fixed (can contain as much as a few dozens files) as they are being read from a XML file whose content may vary. The curl command itself is being built at runtime, based on XML parsing results.
I control the XML file content, meaning I can make sure it includes values such as "my%20file%20with%20spaces.ext", "my file with spaces.ext" or even something else.
Still , the requirement is to save files in my local filesystem with exactly the same name as found in the webserver.
Is there a way to do that, without explicitly name every output file for each downloaded file?
Meaning, I really wouldn't like to do something like:
curl.exe
"http://myserver.com/file1.ext" -o "C:myfolderfile1.ext"
"http://myserver.com/file2.ext" -o "C:myfolderfile2.ext"
"http://myserver.com/my%20file%20with%20spaces.ext" -o "C:myfoldermy file with spaces.ext"
Though I'm currently working in Windows, I would favor a cross-platform solution.
So, any suggestions how to download files with spaces, following above requirements?
Thank you in advance.
PS-Happy New Year!! :-)
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…