Skip to content

Instantly share code, notes, and snippets.

@bennyfactor
Last active September 9, 2018 04:49
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 bennyfactor/ec6bb01490adc23a96eb1630527d5734 to your computer and use it in GitHub Desktop.
Save bennyfactor/ec6bb01490adc23a96eb1630527d5734 to your computer and use it in GitHub Desktop.
Download somebody's scan of the 1990 Dodge Pickup Truck Factory Service Manual, save files in proper page order

It's a lot better to do this in bash, zsh's expansion/glob facilities are too smart for their own good and mess up some of the commands.

wget --random-wait -e robots=off -U mozilla https://manuals.co/workshop/dodge/ram/dodge-ram-1990-workshop-manual-rear-wheel-drive-truck/5575968/{1..1134}
grep -o s3.eu.west.1.amazonaws.com.manuals.co.5575968.bg.\*.png * | sed -e "s/:/.png https:\/\//g" | sed -e "s/^/wget -e robots=off -U mozilla \-O /g" > wget.sh
bash wget.sh
ls | grep -v .png | xargs rm
rename 's/.png$//' *
for f in *; do mv $f `printf %04d ${f}`; done
rename 's/$/.png/' *
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment