I want to download multiple files from internet using wget -P /Users/<user>/Desktop/folder "link".
All the links have the form "hello01world","hello02world","hello03world" and so on

How can I write only one command line script that downloads all of them using for example a loop?
How do I modify the strings to get all links?

  • 1
    Use wget -i urls.txt, where urls.txt contains the URLs to download, one URL per line.
    – lhf
    Jun 7, 2021 at 14:10
  • This also works but it's not exactly what I intended.
    – Pa Dalton
    Jun 7, 2021 at 14:43

1 Answer 1


man wget is a good place to start if you are unsure about the options a command supports:

  • wget -P /path/to/folder link1 link2 link3
  • Add all links to a file and then run wget -i FILE -P /path/to/folder

But if you want to auto-generate a link including numbers you may be better off using

  • wget -P /path/to/folder hello{00..99}world (works in bash and zsh)
  • cd /path/to/folder; curl -O 'hello[00-99]world'
  • Many thanks, this does exactly what I wanted!
    – Pa Dalton
    Jun 7, 2021 at 14:41
  • wget being cross-platform, this can be used in Linux or Windows too, etc.
    – cipricus
    Nov 2 at 15:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .