Movatterモバイル変換


[0]ホーム

URL:


everything curl

    Multiple downloads

    As curl can be told to download many URLs in a single command line, there are,of course, times when you want to store these downloads in nicely named localfiles.

    The key to understanding this is that each download URL needs its own "storageinstruction". Without said "storage instruction", curl defaults to sending thedata to stdout. If you ask for two URLs and only tell curl where to save thefirst URL, the second one is sent to stdout. Like this:

    curl -o one.html http://example.com/1 http://example.com/2

    The "storage instructions" are read and handled in the same order as thedownload URLs so they do not have to be next to the URL in any way. You canround up all the output options first, last or interleaved with the URLs. Youchoose.

    These examples all work the same way:

    curl -o 1.txt -o 2.txt http://example.com/1 http://example.com/2curl http://example.com/1 http://example.com/2 -o 1.txt -o 2.txtcurl -o 1.txt http://example.com/1 http://example.com/2 -o 2.txtcurl -o 1.txt http://example.com/1 -o 2.txt http://example.com/2

    The-O is similarly just an instruction for a single download so if youdownload multiple URLs, use more of them:

    curl -O -O http://example.com/1 http://example.com/2

    Parallel

    Unless told otherwise, curl downloads all given URLs in a serial fashion, oneby one. By using-Z (or--parallel) curl can instead do the transfersin parallel: several ones at once.


    [8]ページ先頭

    ©2009-2025 Movatter.jp