Skip to content

Instantly share code, notes, and snippets.

@kinoute
Created July 16, 2019 19:52
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 kinoute/f8c9b9435ffe116d23546dde83e512d4 to your computer and use it in GitHub Desktop.
Save kinoute/f8c9b9435ffe116d23546dde83e512d4 to your computer and use it in GitHub Desktop.
#/bin/bash
shopt -s nullglob
downloadFromFile(){
while read -r URL <&3; do
wget --content-disposition $(echo $URL | tr -d '\r') -P "$1/"
done 3<"$2"
}
for d in *; do
if [ -d "$d" ]; then
VIDEOS_TXT=$(ls "$d"/*.txt)
if [ -n "$VIDEOS_TXT" ]; then
downloadFromFile "$d" "$VIDEOS_TXT"
fi
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment