Last active
September 25, 2020 08:33
-
-
Save RuizSerra/d4cc4d89001c4e1899faccf8aee4e62c to your computer and use it in GitHub Desktop.
Tidy up Zettelkasten vault
This file contains hidden or 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 | |
# | |
# Tidy up files in Zettelkasten vault | |
# Ensure we are running this in the right directory | |
[[ "$(basename $PWD)" -eq "zettelkasten" ]] || exit 1 | |
# Delete empty files | |
find . -type f -size 0 -exec echo Removing empty file: {} \; -exec rm "{}" \; | |
# Daily notes to directory | |
for f in $(ls | grep -E "^\d{4}-\d{2}-\d{2}.md"); do | |
echo "Moving daily note $f to Diary/" | |
mv $f Diary/ | |
done | |
# Paper notes to directory | |
for f in $(ls | grep -E "^[A-Z][a-zA-Z]+\d{4}\w?.md"); do | |
echo "Moving notes from $f to Papers/" | |
mv $f Papers/ | |
done | |
# Git dump | |
git add --all | |
git commit -am 'dump' | |
git push |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment