简体   繁体   中英

Download batch files from a website using linux

i want to downloads some files (nearly about 1000-2000 zip files) from a website. i can sit around and add each file one after another. please give me a program or script or whatever method so i can automate the download.

The website i am talking about has download link as

sitename.com/sometetx/date/12345/folder/12345_zip.zip

date can be taken care of. the main concern is that number 12345 before and after the folder, they both change simultaneously. eg

sitename.com/sometetx/date/23456/folder/23456_zip.zip sitename.com/sometetx/date/54321/folder/54321_zip.zip

i tried using curl

sitename.com/sometetx/date/[12345-54321]/folder/[12345-54321]_zip.zip

but it makes to much of combination of downloads ie keeps left 12345 as it is and scan through 12345 to 54321 the increment left 12345 +1 then repeats scan from [12345-54321].

also tried bash wget here i have one variable at two places, when using loop the right 12345 with a " _" is ignored by the program. PLease help me, i dont know much about linux or programing, thanks

In order to get your loop variable next to _ to not be ignored by the shell, put it in the quotes, like this:

$ for ((i=10000; i < 99999; i++)); do \ 
    wget sitename.com/sometetx/date/$i/folder/"$i"_zip.zip; done

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM