Skip to content

Instantly share code, notes, and snippets.

@lccxx
Created July 20, 2012 08:15
Show Gist options
  • Save lccxx/3149504 to your computer and use it in GitHub Desktop.
Save lccxx/3149504 to your computer and use it in GitHub Desktop.
download all pic
#!/bin/bash
auth='--ntlm --user xxmu\xxyxy:1234567'
host="http://www.xxmu.edu.cn"
dir=$host"/tpxz/2012%E5%B1%8A%E6%9C%AC%E7%A7%91%E6%AF%95%E4%B8%9A%E7%94%9F%E6%AF%95%E4%B8%9A%E5%85%B8%E7%A4%BC%E7%85%A7%E7%89%87/"
function get_href {
grep -io 'href="[^"]*"' | sed -r 's/href="([^"]*)"/\1/i'
}
for d in `curl $auth $dir | get_href`; do
for p in `curl $auth $host$d | get_href`; do
curl $auth $host$p > "`basename $p`"
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment