]> apps.delaporte.us Git - minion.git/blob - bin/mma
Fix for bash octal
[minion.git] / bin / mma
1 #!/bin/bash
2 # mma - minion move to archive
3 # Moves all matching files to $HOME/Journal/archive_YYYY/
4
5 year=`date +%Y`
6 # File to gather all content into
7 topic=$1
8 if [ ! -n "$1" ]; then
9 echo "A topic to archive is required."
10 exit 1
11 fi
12 archive="$HOME/Journal/archive-$year/"
13
14 files=$(find $HOME/Journal/$year -type f -iname "*$1*\.md")
15 if [ -n "$files" ]; then
16 echo "Will archive $files to $archive"
17 else
18 echo "Nothing to archive for $topic"
19 fi
20
21 echo ""
22 read -n1 -p "Continue? [y,N]" input
23 echo ""
24 if [[ ! $input == "Y" && ! $input == "y" ]]; then
25 echo "Aborted by user"
26 exit 1
27 fi
28
29 mkdir -p $archive
30 mv $files $archive