]> us-delaporte.pagekite.me Git - minion.git/commitdiff
Add minion move archive command
authorEdward <delaport@illinois.edu>
Fri, 31 Jul 2026 20:52:43 +0000 (15:52 -0500)
committerEdward <delaport@illinois.edu>
Fri, 31 Jul 2026 20:52:43 +0000 (15:52 -0500)
bin/mma [new file with mode: 0755]

diff --git a/bin/mma b/bin/mma
new file mode 100755 (executable)
index 0000000..e45d311
--- /dev/null
+++ b/bin/mma
@@ -0,0 +1,30 @@
+#!/bin/bash
+# mma - minion move to archive
+# Moves all matching files to $HOME/Journal/archive_YYYY/
+
+year=`date +%Y`
+# File to gather all content into
+topic=$1
+if [ ! -n "$1" ]; then
+       echo "A topic to archive is required."
+       exit 1
+fi
+archive="$HOME/Journal/archive-$year/" 
+
+files=$(find $HOME/Journal/$year -type f -iname "*$1*\.md")
+if [ -n "$files" ]; then
+       echo "Will archive $files to $archive"
+else
+       echo "Nothing to archive for $topic"
+fi
+
+echo ""
+read -n1 -p "Continue? [y,N]" input
+echo ""
+if [[ ! $input == "Y" && ! $input == "y" ]]; then
+       echo "Aborted by user"
+       exit 1
+fi
+
+mkdir -p $archive
+mv $files $archive