Use Curl to batch download files from a website

In this example, we suppose all the files are in the same folder on the website and the file names have the same pattern:

$ curl -L -O http://www.example site.com/color/pic/fire[1-5].gif

-L : Follows all redirections until the final destination page is found. This switch is almost always required as curl won’t follow redirects by default (read about how to check the server http headers with curl).
-O : By using this switch you instruct curl to save the downloaded data to a file in the current directory. The filename of the remote file is used. This switch is also required or else curl will print the data to stdout, which is something you won’t probably like.


wget all files of the same type

To get all the pdf files:this command does not work on all websites.

$ wget -r -l1 –no-parent -A.pdf  <url>

No comments:

Post a Comment

Datatable static image not found on the server

When you use ```datatables.min.css``` and ```datatables.min.js``` locally, instead of datatables CDN, you may have encountered that ```sort...