mirror of
https://github.com/rossant/awesome-math.git
synced 2024-10-01 01:15:40 -04:00
download all pdf files
This commit is contained in:
parent
242abb9113
commit
99d2c46085
1
.gitignore
vendored
Normal file
1
.gitignore
vendored
Normal file
@ -0,0 +1 @@
|
||||
pdf
|
25
download-all-pdf.sh
Executable file
25
download-all-pdf.sh
Executable file
@ -0,0 +1,25 @@
|
||||
#!/bin/bash
|
||||
|
||||
# --------------------------------- Create the pdf directory if not exists --
|
||||
if [ ! -d pdf ]; then
|
||||
mkdir pdf
|
||||
fi
|
||||
|
||||
# ---------------------------------------- Add pdf directory to .gitignore --
|
||||
if [ ! -f .gitignore ]; then
|
||||
echo pdf > .gitignore
|
||||
else
|
||||
grep -q -F 'pdf' .gitignore || echo 'pdf' >> .gitignore
|
||||
fi
|
||||
|
||||
# ---------------------------------------- Download pdf file if not exists --
|
||||
for f in `sed -rn 's/.*(http.+\.pdf).*/\1/pg' README.md`
|
||||
do
|
||||
if [ ! -f "pdf/${f##*/}" ]; then
|
||||
wget --tries=3 \
|
||||
--timeout=5 \
|
||||
--waitretry=1 \
|
||||
--retry-connrefused \
|
||||
"$f" -P pdf
|
||||
fi
|
||||
done
|
Loading…
Reference in New Issue
Block a user