Skip to content

Instantly share code, notes, and snippets.

@colegeissinger
Created August 5, 2020 22:26
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 colegeissinger/3b87af03fccbeecfae19a5c39e472f7d to your computer and use it in GitHub Desktop.
Save colegeissinger/3b87af03fccbeecfae19a5c39e472f7d to your computer and use it in GitHub Desktop.
Loop over a CSV of image URL's and download them while retaining the folder structure.
#!/usr/bin/env bash
filename="$1"
while IFS="," read f1
do
# Remove the carriage return on the URL which makes for invalid URL's on some servers.
URL=$(echo $f1 | tr -d '\r')
# Fetch the file.
wget -x -nH "$URL"
done < "$filename"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment