aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCache do Fluxo <cache@fluxo.info>2017-04-20 00:10:43 -0300
committerCache do Fluxo <cache@fluxo.info>2017-04-20 00:10:43 -0300
commitef9c0cb69b4804b680ef679ecaca36f2247f4e16 (patch)
tree2f426940ddcf1146bb8578b9b4a95e89a2686c66
parent830a5bf8534089417f5995632a28010dff9cd346 (diff)
downloadcache-ef9c0cb69b4804b680ef679ecaca36f2247f4e16.tar.gz
cache-ef9c0cb69b4804b680ef679ecaca36f2247f4e16.tar.bz2
Adds bin/pdflinks
-rwxr-xr-xbin/pdflinks16
1 files changed, 16 insertions, 0 deletions
diff --git a/bin/pdflinks b/bin/pdflinks
new file mode 100755
index 0000000..6c7879f
--- /dev/null
+++ b/bin/pdflinks
@@ -0,0 +1,16 @@
+#!/bin/bash
+#
+# Ensure there are PDF links.
+#
+
+find data -iname '*.pdf' | grep -v 'screenshot.pdf' | while read line; do
+ first="`echo $line | cut -d '/' -f 2`"
+ second="`echo $line | cut -d '/' -f 3`"
+ third="`echo $line | cut -d '/' -f 4`"
+ url_base="$(basename "$line")"
+
+ if [ ! -e "$first/$second/$third/$url_base" ]; then
+ echo "Processing $first/$second/$third..."
+ ( cd data/$first/$second/$third && find -iname '*.pdf' -exec ln -s {} "$url_base" \;)
+ fi
+done