1

Is it possible to if check a url/file/link and then let curl download it if it exists?

if check "https://example.com/blabla/blabla.zip" (
curl ... 
)
1

To check if a file in link exist using curl use -I flag:

-I, --head

(HTTP FTP FILE) Fetch the headers only! HTTP-servers feature the command HEAD which this uses to get nothing but the header of a document. When used on an FTP or FILE file, curl displays the file size and last modification time only.


curl.exe -I https://mirror.turbozoneinternet.net.br/videolan/vlc/3.0.8/win64/vlc-3.0.8-win64.exe | find "Content-Length:" >nul && (
echo / && echo/ Your link/file is Ok, downloading... && echo/ 
curl.exe -# https://mirror.turbozoneinternet.net.br/videolan/vlc/3.0.8/win64/vlc-3.0.8-win64.exe -o %temp%\vlc-3.0.8-win64.exe
) || (echo/ Error^!)

This is adapted code from answer /by @pberlijn


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.