Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Split file names into year and month folder
for file in *; do
echo $file;
yearmonth=$(echo $file | grep -o '[0-9][0-9][0-9][0-9]-[0-9][0-9]')
newfilename=$(echo $file | grep -o '[0-9][0-9]-[a-z].*.md$')
mkdir $yearmonth
mv $file $yearmonth/$newfilename
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.