~smlavine/scripts

6b6b353a93f3267f6ada9e9d117b2aac3a5d0fa2 — Sebastian LaVine a month ago 3f7ca23
src/download: Add recursive functionality
1 files changed, 19 insertions(+), 1 deletions(-)

M src/download
M src/download => src/download +19 -1
@@ 8,6 8,24 @@
#                        discretion is advised.
# Arguments:   URLs to download.

usage()
{
	echo "USAGE: download [-r] [url]..."
}

while getopts "rh" o; do
	case "$o" in
		r) recurse=1 ;;
		*) usage; exit ;;
	esac
done

shift $((OPTIND - 1))

for file in "$@"; do
	curl -LO "$file"
	if [ "$recurse" ]; then
		wget -r -l 0 -e robots=off "$file"
	else
		curl -LO "$file"
	fi
done