From ef9c0cb69b4804b680ef679ecaca36f2247f4e16 Mon Sep 17 00:00:00 2001 From: Cache do Fluxo Date: Thu, 20 Apr 2017 00:10:43 -0300 Subject: Adds bin/pdflinks --- bin/pdflinks | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 bin/pdflinks (limited to 'bin') 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 -- cgit v1.2.3