title: How do I preserve the remote filename when Downloading a file using curl
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/2698552/how-do-i-save-a-file-using-the-response-header-filename-with-curl">How do I save a file using the response header filename with cURL</a>  </p>
  </blockquote>
  
  
  
  <p>I need to download many thousands of images in the format</p>
  
  <p><a href="http://oregondigital.org/cgi-bin/showfile.exe?CISOROOT=/baseball&amp;CISOPTR=0" rel="noreferrer">http://oregondigital.org/cgi-bin/showfile.exe?CISOROOT=/baseball&amp;CISOPTR=0</a></p>
  
  <p>If you paste that link in a browser, it tries to download a file named 1.jp2</p>
  
  <p>I want to use curl to do the same. However, when I run </p>
  
  <p>curl -I '<a href="http://oregondigital.org/cgi-bin/showfile.exe?CISOROOT=/baseball&amp;CISOPTR=0" rel="noreferrer">http://oregondigital.org/cgi-bin/showfile.exe?CISOROOT=/baseball&amp;CISOPTR=0</a>'</p>
  
  <p>the filename is reported as 404.txt which you can download and see that it is actually the file I want. I can't use the -O option because the name assigned to the file is no good, and I have technical reasons for needing the actual name used on the system.</p>
  
  <p>How do I get curl to download the same file I have no trouble retrieving in my browser? Thanks.</p>