From: Edward Date: Fri, 31 Jul 2026 20:52:43 +0000 (-0500) Subject: Add minion move archive command X-Git-Url: https://us-delaporte.pagekite.me/gitweb/minion.git/commitdiff_plain/53ea1d6ae5f8cdb1a73fb96aaff5f0c73575a950?ds=sidebyside;hp=1b46195e386f2b00cbb94bf4aa1d17ea22541ca7 Add minion move archive command --- diff --git a/bin/mma b/bin/mma new file mode 100755 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