Skip to content

Instantly share code, notes, and snippets.

@thakyZ
Created April 4, 2022 22:13
Show Gist options
  • Save thakyZ/ef1746eb1ef26f60ad40030cc5887edf to your computer and use it in GitHub Desktop.
Save thakyZ/ef1746eb1ef26f60ad40030cc5887edf to your computer and use it in GitHub Desktop.
Downloads all files in a web directory when web directory uses h5ai
#!/bin/bash
path=$1
download="https://files.example.com/${path}/"
mapfile -t files < <(w3m "${download}" | grep .z | sed 's/file [[:space:]]*//g' | sed 's/[[:space:]]*2022.*KB$//g' | grep -v "Name")
mkdir "${path}"
for f in "${files[@]}"; do
wget "${download}${f}" -O "${path}/${f}"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment