Skip to content

Instantly share code, notes, and snippets.

@sillage
Last active October 30, 2017 23:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save sillage/e50635f2b85d9f7702b0b281206fb8d3 to your computer and use it in GitHub Desktop.
Save sillage/e50635f2b85d9f7702b0b281206fb8d3 to your computer and use it in GitHub Desktop.
#!/bin/bash
# source: https://superuser.com/a/764524
# Managed formats:
# <xmp:CreateDate>2017-07-19T08:53:29Z</xmp:CreateDate>
# <xmp:CreateDate>2017-10-16T12:07:43+02:00</xmp:CreateDate>
# xmp:CreateDate="2013-09-03T17:37:08+02:00"
for f in *.pdf
do
touch -t $(strings "$f" | grep 'xmp:CreateDate' | tail -1 | sed 's_.*xmp:CreateDate.\{1,2\}\(....\)-\(..\)-\(..\)T\(..\):\(..\):\(..\).*_\1\2\3\4\5.\6_g') "$f"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment