Skip to content

Instantly share code, notes, and snippets.

@Sandra-headscape
Created November 23, 2023 17:34
Show Gist options
  • Save Sandra-headscape/19a8ea2fd3c3a4a8c4717dda338d4736 to your computer and use it in GitHub Desktop.
Save Sandra-headscape/19a8ea2fd3c3a4a8c4717dda338d4736 to your computer and use it in GitHub Desktop.
Download list of URLs from a txt file
#!/bin/bash
INPUT=$(find . -name "*.txt")
COUNT=1;
while IFS= read -r line
do
curl -O "$line"
let COUNT++
done < "$INPUT"
echo "count $COUNT"
@Sandra-headscape
Copy link
Author

  • make sure there's a single txt file in the directory
  • make sure file uses LF line endings
  • on a mac, you may need to use chmod +x download.sh to make the file executable

@Sandra-headscape
Copy link
Author

Sandra-headscape commented Nov 24, 2023

count will count all lines (also empties and things that fail to download)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment