Skip to content

Instantly share code, notes, and snippets.

@kris7t
Last active December 13, 2015 20:08
Show Gist options
  • Save kris7t/4967380 to your computer and use it in GitHub Desktop.
Save kris7t/4967380 to your computer and use it in GitHub Desktop.
[
(Hudson-Nelson_*.pdf) { dup length string copy } 1000 string filenameforall
] % create array of filenames
{ lt } .sort % sort in increasing alphabetic order
/PN 1 def
{ /FN exch def
/PN currentpagedevice /PageCount get 1 add def % get current page count done (next is one greater)
FN run [ /Page PN /Title FN /OUT pdfmark % do the file and bookmark it by filename
} forall
#!/usr/bin/env bash
for i in Hudson-Nelson*; do; mv "$i" `echo "$i" | sed -e 's/Hudson-Nelson_\([0-9]*\).*\.pdf$/Hudson-Nelson_\1.pdf/i'`; done
gs -dBATCH -dNOPAUSE -sDEVICE=pdfwrite -o Hudson-Nelson.pdf control.ps
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment