Created
April 7, 2020 13:13
-
-
Save janikvonrotz/e0dc090da99ad28a572a3df6eaaf4180 to your computer and use it in GitHub Desktop.
Split file names into year and month folder
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
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