Update, some years later:
If you're using a newer axel, then please simply use the no-clobber option -c
, instead of implementing it manually as described here!
If you want to make sure axel will resume, as it does per file name and not per url, you should use a deterministic name for the file:
axel -o NAME_OF_EXISTING_FILE
If you want to check if file exists
if [ -f $FILE ]; then
echo "File $FILE exists."
# operation related to when file exists, aka skip download
else
echo "File $FILE does not exist."
# operation related to when file does not exists
fi
In case of axel, you want to start download if...
You do not have that file localy, or
You have a partial download, so
function custom_axel() {
local file_thingy="$1"
local url="$2"
if [ ! -e "$file_thingy" ]; then
echo "file not found, downloading: $file_thingy"
axel -avn8 "$url" -o "$file_thingy"
elif [ -e "${file_thingy}.st" ]; then
echo "found partial download, resuming: $file_thingy"
axel -avn8 "$url" -o "$file_thingy"
else
echo "already have the file, skipped: $file_thingy"
fi
}
This could go into ~/.bashrc or into /usr/bin/custom_axel.sh and later:
while read URL; do
name=$(basename "$URL") # but make sure it's valid.
custom_axel "$name" "$URL"
done < /my/list/of/files.txt