Skip to content

Instantly share code, notes, and snippets.

@zmughal
Created August 1, 2012 07:51
Show Gist options
  • Save zmughal/3224719 to your computer and use it in GitHub Desktop.
Save zmughal/3224719 to your computer and use it in GitHub Desktop.
#!/bin/sh
LINKURL="http://techinfo.honda.com/rjanisis/pubs/OM/AC9595/AC9595MAINIDX.pdf"
BASEURL="http://techinfo.honda.com/rjanisis/pubs/OM/AC9595/"
mkdir download-pdf 2> /dev/null
cd download-pdf
wget "$LINKURL"
mkdir PDF 2> /dev/null
while `ls *.pdf 2>&1 >/dev/null`; do
PDFs_INDONE=`wc -l DONE.list | cut -d' ' -f1`
PDFs_INDIR=`ls *.pdf|wc -l`
echo "$PDFs_INDONE $PDFs_INDIR"
if [ "$PDFs_INDONE" = "$PDFs_INDIR" ]; then
break;
fi
for PDF in `ls *.pdf`; do
if grep "$PDF" DONE.list 2>&1 > /dev/null; then
continue
fi
pdftohtml -i "$PDF"
BASENAME=`basename "$PDF" .pdf`
wget -c -B "$BASEURL" --mirror -nd --force-html -A pdf -i "$BASENAME"'s.html' 2>&1 /dev/null
echo "$PDF" >> DONE.list
done
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment