summaryrefslogtreecommitdiff
path: root/scraper/pdf_dump_first_page.sh
diff options
context:
space:
mode:
authorAdam Harvey <adam@ahprojects.com>2018-12-23 01:37:03 +0100
committerAdam Harvey <adam@ahprojects.com>2018-12-23 01:37:03 +0100
commit4452e02e8b04f3476273574a875bb60cfbb4568b (patch)
tree3ffa44f9621b736250a8b94da14a187dc785c2fe /scraper/pdf_dump_first_page.sh
parent2a65f7a157bd4bace970cef73529867b0e0a374d (diff)
parent5340bee951c18910fd764241945f1f136b5a22b4 (diff)
.
Diffstat (limited to 'scraper/pdf_dump_first_page.sh')
-rw-r--r--scraper/pdf_dump_first_page.sh25
1 files changed, 25 insertions, 0 deletions
diff --git a/scraper/pdf_dump_first_page.sh b/scraper/pdf_dump_first_page.sh
new file mode 100644
index 00000000..6277d40c
--- /dev/null
+++ b/scraper/pdf_dump_first_page.sh
@@ -0,0 +1,25 @@
+#!/bin/bash
+
+for i in datasets/s2/pdf/*/*/*.pdf
+ do
+ OUTPUT="${i%.*}.txt"
+ if [[ ! -e $OUTPUT ]]
+ then
+ pdf2txt.py -p 1 $i > $OUTPUT
+ if [ -s $OUTPUT ]
+ then
+ echo "found $OUTPUT"
+ else
+ echo "rm empty $OUTPUT"
+ rm -f $OUTPUT
+ fi
+ else
+ if [ -s $OUTPUT ]
+ then
+ echo "found $OUTPUT"
+ else
+ echo "rm empty $OUTPUT"
+ rm -f $OUTPUT
+ fi
+ fi
+ done