Skip to content

Instantly share code, notes, and snippets.

@RuizSerra
Last active September 25, 2020 08:33
Show Gist options
  • Save RuizSerra/d4cc4d89001c4e1899faccf8aee4e62c to your computer and use it in GitHub Desktop.
Save RuizSerra/d4cc4d89001c4e1899faccf8aee4e62c to your computer and use it in GitHub Desktop.
Tidy up Zettelkasten vault
#!/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