I have a list which contains imgur links, I want to download the links from it and auto rename them with wget.

For example, these are the links in the list:


I want to download them as img1.jpg and img2.jpg.

  • Does it have to be with wget only? – Pylsa Aug 4 '15 at 14:54
  • No, anything that can help is cool. – JohnJogn Aug 4 '15 at 14:58
  • Are they all jpegs? – Pylsa Aug 4 '15 at 16:00
  • yes they are... – JohnJogn Aug 4 '15 at 16:05
  • There ya go! See my answer! – Pylsa Aug 4 '15 at 16:12

Try this bash script (only works for .jpg). I know it's probably not the most elegant solution, but it should do the trick! Change list.txt to the name of your list file:


while read p; do
  wget -O "img${count}.jpg" $p
done <list.txt

How do I use this?

  1. Create a new file where you want to download your images to, name it however you like, e.g. downloadlist.sh.
  2. Add contents from script above to file, change list.txt to whatever your list file is called and save.
  3. Make it executable using chmod:

    chmod +x downloadlist.sh
  4. Execute the file and sit back while it processes:

| improve this answer | |
  • Works fine, thanks. One more question, how would you rename the first 9 files like this img01.jpg img09.jpg? – JohnJogn Aug 4 '15 at 17:05
  • 1
    The more kosher way of doing it is while IFS=read line. – theoden8 Aug 4 '15 at 17:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.