download list of images from urls

后端 未结 1 788
旧巷少年郎
旧巷少年郎 2021-01-25 14:25

I need to find (preferably) or build an app for a lot of images. Each image has a distinct URL. There are many thousands, so doing it manually is a huge effort. The list is cur

1条回答
  •  [愿得一人]
    2021-01-25 15:09

    Are you on Windows or Mac/Linux? In Windows you can use a powershell script for this, on mac/linux a shell script with about 1-5 lines of code.

    Here's one way to do this:

    # show what's inside the file
    cat urlsofproducts.csv
    
    http://bit.ly/noexist/obj101.jpg, screwdriver, blackndecker
    http://bit.ly/noexist/obj102.jpg, screwdriver, acme
    
    # this one-liner will GENERATE one download-command per item, but will not execute them
    perl -MFile::Basename -F", " -anlE "say qq(wget -q \$F[0] -O '\$F[1]--\$F[2]--).  basename(\$F[0]) .q(')" urlsofproducts.csv 
    
    
    
    # Output :
    wget http://bit.ly/noexist/obj101.jpg -O ' screwdriver-- blackndecker--obj101.jpg'
    wget http://bit.ly/noexist/obj101.jpg -O ' screwdriver-- acme--obj101.jpg'
    

    Now back-substitute the wget commands into the shell.

    0 讨论(0)
提交回复
热议问题