Created
May 14, 2023 17:35
-
-
Save y4my4my4m/c6ec7d086e456b5cda659b1e2145843b to your computer and use it in GitHub Desktop.
Recursive wget downloader
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 | |
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