-
-
Save ear1grey/c73764762b0f52bb0d98 to your computer and use it in GitHub Desktop.
Front Matter Move: Rename files in a folder based on the date contained in jekyll/markdown frontmatter
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
# extracts date from file in the format | |
# date: 2013-08-23 14:52:59 | |
# and prepends this to the filename | |
for f in *.md; do | |
c="$(grep -Eo 'date:\W(....-..-..)' $f | cut -d: -f2 | xargs)" | |
mv "$f" "$c-$f" | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment