Skip to content

Instantly share code, notes, and snippets.

@bardic
Created September 29, 2019 17:13
Show Gist options
  • Select an option

  • Save bardic/a4df76ea07dc26503e542742de800369 to your computer and use it in GitHub Desktop.

Select an option

Save bardic/a4df76ea07dc26503e542742de800369 to your computer and use it in GitHub Desktop.
#!/bin/bash
for f in ./posts/*.md;do
echo "Processing $f file..."
IFS='/' read -r -a array <<< "$f"
# take ~action on each file. $f store current file name
echo ${array[2]}
FNAME=${array[2]}
CLEANNAME=${FNAME:0:9}
echo "cat $CLEANNAME"
mkdir "./posts/$CLEANNAME"
mv $f "./posts/$CLEANNAME/index.md"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment