Created
February 2, 2024 13:13
-
-
Save smarteist/bdc2b3a9f3c74ad1b848355f6257c9d5 to your computer and use it in GitHub Desktop.
bash downloader via curl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/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