Skip to content

Instantly share code, notes, and snippets.

@chandruscm
Last active September 4, 2021 13:47
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save chandruscm/ef250e26ba307f028073bb582db34a42 to your computer and use it in GitHub Desktop.
Save chandruscm/ef250e26ba307f028073bb582db34a42 to your computer and use it in GitHub Desktop.
Shell script to download images listed in an images.txt folder. Each line has the imageUrl and the fileName to be saved, separated by a space. To run ${zsh download-images.sh}. Reference: https://stackoverflow.com/questions/36192423/wget-download-files-with-filename-from-list-of-urls-using-wget
#!/bin/sh
IFS=$'\n'
for line in $(cat images.txt)
do
url=$(echo $line | awk '{ print $1 }')
out=$(echo $line | awk '{ print $2 }')
wget --user-agent="Mozilla" "$url" -O "$out"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment