Merge branch 'master' of charles:/tank/andrew/code/scripts
authorAndrew Lorimer <andrew@lorimer.id.au>
Tue, 19 Nov 2019 06:12:40 +0000 (17:12 +1100)
committerAndrew Lorimer <andrew@lorimer.id.au>
Tue, 19 Nov 2019 06:12:40 +0000 (17:12 +1100)
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