add pdf-mv.sh
authorAndrew Lorimer <andrew@lorimer.id.au>
Fri, 2 Aug 2019 06:56:28 +0000 (16:56 +1000)
committerAndrew Lorimer <andrew@lorimer.id.au>
Fri, 2 Aug 2019 06:56:28 +0000 (16:56 +1000)
no idea what this was for, I don't even remember writing it

pdf-mv.sh [new file with mode: 0755]
diff --git a/pdf-mv.sh b/pdf-mv.sh
new file mode 100755 (executable)
index 0000000..a552fe3
--- /dev/null
+++ b/pdf-mv.sh
@@ -0,0 +1,6 @@
+#! /bin/bash
+
+for oldfile in "$@"; do
+  newname=$(pdfinfo -meta $oldfile | sed -n '/MT-.../p' | sed -n 's/.*\(MT-...\): \(.*\)<.*/\L\1-\2\.pdf/; s/ /-/gp')
+  mv $oldfile $newname
+done