]> gitweb.fluxo.info Git - cache.git/commitdiff
Adds bin/pdflinks
authorCache do Fluxo <cache@fluxo.info>
Thu, 20 Apr 2017 03:10:43 +0000 (00:10 -0300)
committerCache do Fluxo <cache@fluxo.info>
Thu, 20 Apr 2017 03:10:43 +0000 (00:10 -0300)
bin/pdflinks [new file with mode: 0755]

diff --git a/bin/pdflinks b/bin/pdflinks
new file mode 100755 (executable)
index 0000000..6c7879f
--- /dev/null
@@ -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