Skip to content

Instantly share code, notes, and snippets.

@y4my4my4m
Created May 14, 2023 17:35
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 y4my4my4m/c6ec7d086e456b5cda659b1e2145843b to your computer and use it in GitHub Desktop.
Save y4my4my4m/c6ec7d086e456b5cda659b1e2145843b to your computer and use it in GitHub Desktop.
Recursive wget downloader
#!/bin/bash
base_url="https://files.artpacks.org"
index_page="/"
# Function to process a URL
process_url() {
local url=$1
if [[ $url =~ \.zip$ ]]; then # if it's a zip file
wget "${base_url}${url}"
else # if it's a directory
wget -qO- "${base_url}${url}" | grep -oP 'href="\K[^"]*' | while read -r line; do
process_url "$line"
done
fi
}
# Start processing from the index page
process_url "$index_page"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment