wget -i: Download a List of URLs
wget -i <file> downloads every URL listed in the file, one per line.
When a job needs several artifacts, listing their URLs and running wget -i once is cleaner than a loop and reuses connections where possible.
What it does
wget -i <file> (--input-file) reads URLs from the given file, one per line, and downloads each. Use -i - to read the list from stdin. Lines that are not URLs are skipped unless -F treats the file as HTML to scan for links.
Common usage
wget -i urls.txt -P ./downloads
# read the list from stdin
printf '%s\n' "$URLS" | wget -i -
# input file with retries and quiet output
wget -nv --tries=3 -i urls.txtOptions
| Flag | What it does |
|---|---|
| -i <file> / --input-file | Read URLs to download from the file |
| -i - | Read the URL list from stdin |
| -P <dir> | Save all downloads under this directory |
| -F / --force-html | Treat the input file as HTML and follow its links |
| -B <url> / --base | Resolve relative links against this base URL |
In CI
Generating a urls.txt and running one wget -i keeps logs compact and is easy to retry as a unit. Add -nv and --tries so a single transient failure in the batch does not fail the whole step. -O does not make sense with -i since there are many files.
Common errors in CI
No URLs found in urls.txt means the file is empty, all lines are comments, or the path is wrong. A single bad line failing the run can be mitigated with --tries and by checking exit codes per file; wget continues the list but exits non-zero if any URL failed.