Created
March 28, 2012 14:06
-
-
Save pichfl/2226461 to your computer and use it in GitHub Desktop.
A quick and dirty bash file that converts a folder full of YYYY-MM-DD-*name*.markdown into folders with textfiles for use with Kirby CMS
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/bash | |
cd /folder/with/your/posts | |
COUNTER=1 | |
for filename in * | |
do | |
echo "----" >> $filename | |
echo "Date: ${filename:0:10}" >> $filename | |
echo "----" >> $filename | |
newfilename=${filename:11} | |
newfilename=${newfilename%.markdown} | |
foldername=$COUNTER-$newfilename | |
COUNTER=$(($COUNTER + 1)) | |
mkdir $foldername | |
mv $filename $foldername/post.txt | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment