Forums

Discuss all things Remember The Milk.

Bulk-add Timed Task Batches with a Shell Script

fabianhemmert says:
I often go on business trips, for which I find myself always add the same tasks: Book the flight and hotel (timed three weeks in advance), pack (timed on the day before) and file an expense report (timed on the day after the event).

I wrote a little shell script (based on rumember, https://github.com/tpope/rumember) that automates this. It calculates the relative dates and makes a list of tasks, in relative timing to the "main" thing. It can surely be adjusted to suit your needs in terms of timed tasks that often occur together:


--- trip --

#!/bin/bash

if [ -z "$2" ]
then
echo ""
echo "Syntax: trip TITLE 31.05.2015"
else


day=`date -jf '%d.%m.%Y' $2 '+%d.%m.%Y'`

day_after=`date -v+1d -ujf"%d.%m.%Y" $day +%d.%m.%Y`;
day_before=`date -v-1d -ujf"%d.%m.%Y" $day +%d.%m.%Y`;
threeweeks_before=`date -v-21d -ujf"%d.%m.%Y" $day +%d.%m.%Y`;

#cat > todo.txt << EOL
ru Book Flight $1 $threeweeks_before '#Timed'
ru Book Hotel $1 $threeweeks_before '#Timed'
ru Pack for $1 $day_before '#Timed'
ru Expense Report $1 $day_after '#Timed'
#EOL

#cat todo.txt

#mail -s "" xxxxxxxxxxxxxx+import@rmilk.com < todo.txt

fi

---------
Posted at 11:32am on July 23, 2015
emily (Remember The Milk) says:
Hi Fabian,

This is really cool -- love how it adds the tasks with relative dates. You're this week's Tips & Tricks Tuesday winner, and we've added a free year of Pro to your Remember The Milk account. :)
Posted 8 years ago
Log in to post a reply.