Skip to content

Instantly share code, notes, and snippets.

@marco-brandizi
Last active November 10, 2021 11:08
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 marco-brandizi/1b0d8278dbf924743ac78a4e2bd6f764 to your computer and use it in GitHub Desktop.
Save marco-brandizi/1b0d8278dbf924743ac78a4e2bd6f764 to your computer and use it in GitHub Desktop.
#!/usr/bin/env bash
# Downloads multiple files available from an HTML URL, typically the web listing of a directory,
# as it is rendered by many web servers.
# ==> Requires lftp
#
set -e
# Example:
#  ./files-from-url.sh https://knetminer.com/downloads/agri-schemas/gxa/v202110/ gxa
# Downloads all the files in this version into the local gxa/ dir (creates it if necessary)
#
url="$1"
out="$2"
lftp="set ssl:verify-certificate no;"
lftp="$lftp mirror -v --continue '$url' '$out'"
lftp="$lftp;exit"
lftp -e "$lftp"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment