Skip to content

Instantly share code, notes, and snippets.

@smarteist
Created February 2, 2024 13:13
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 smarteist/bdc2b3a9f3c74ad1b848355f6257c9d5 to your computer and use it in GitHub Desktop.
Save smarteist/bdc2b3a9f3c74ad1b848355f6257c9d5 to your computer and use it in GitHub Desktop.
bash downloader via curl
#!/bin/bash
# Define the list of URLs
urls=(
"https://.mkv"
"https://.mkv"
)
# Define the resumable downloader function
download_file() {
url="$1"
fileName=$(basename "$url")
if [ -f "$fileName" ]; then
from=$(stat -c%s "$fileName")
curl -L -C $from -o "$fileName" "$url"
else
curl -L -o "$fileName" "$url"
fi
echo "Download finished: $fileName"
}
# Iterate over the URLs and download the files
for url in "${urls[@]}"; do
download_file "$url"
echo
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment