Check If File is Downloadable

Save this script into a file, for example, check_download.sh, and make it executable with chmod +x check_download.sh. Then run it using ./check_download.sh. Make sure to replace file.txt with the name of your actual text file containing the download links.

This script will iterate over each line in the text file, attempt to download the file using curl’s head request (which only checks if the file is downloadable without actually downloading it), and then print whether the file is downloadable or not.

#!/bin/bash

# Replace 'file.txt' with the name of your text file
while IFS= read -r url; do
    if curl --output /dev/null --silent --head --fail "$url"; then
        echo "$url is downloadable"
    else
        echo "$url is not downloadable"
    fi
done < file.txt