Skip to content

Instantly share code, notes, and snippets.

@macdet
Forked from pdelteil/download.Wahoo.sh
Created April 24, 2024 04:49
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 macdet/ae36cffd5d9e6a7beed35ad56f0f3d92 to your computer and use it in GitHub Desktop.
Save macdet/ae36cffd5d9e6a7beed35ad56f0f3d92 to your computer and use it in GitHub Desktop.
#!/bin/bash
# Prompt the user to specify whether they want to remove the downloaded files or not
read -p "Do you want to remove the downloaded files? (y/n): " remove_files
# Loop through a range of numbers from 7422 to 17000
for i in $(seq 7422 17000); do
# Construct the filename based on the current loop iteration
filename="BoltApp-$i.apk"
# Construct the URL based on the current loop iteration
URL="https://wahoo-cloud-eu.wahooligan.com/firmware/elemnt/boltapp/$i/BoltApp.apk"
# Download the file specified by the URL using wget
wget "$URL" -nc -O "$filename"
# Check if the downloaded file has a size greater than 0
if [ -s "$filename" ]; then
# Print a message indicating that the file with the current version was found
echo "Version $i found"
# Use ls and awk to extract file details (size, filename, URL) and append them to output.txt
ls -hl "$filename" | awk -v var="$URL" '{print $5 "," $9 "," var}' >> output.txt
# If the user wants to remove the downloaded files, remove the current file
if [ "$remove_files" = "y" ]; then
rm -f "$filename"
fi
else
# Print a message indicating that the file with the current version doesn't exist
echo "Version $i doesn't exist"
fi
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment