I am using org-mode to manage my tasks and the logbook functionality to log my hours as I work on tasks. At the end of the month, I compile the time I spent using clocktables. When I deem a task as "complete", I toggle the item "DONE" (C-c t d).

I am now looking for a way to archive (to a separate file) all those headlines that are marked as "DONE", and have no Logbook entries after a given date (for example, the start of this month.) That would allow me to safely archive older headlines without the risk of archiving unbilled hours.

So far I have been looking into org-agenda-custom-commands and/or C-c a < m with a query something like tasks+TODO="DONE"+CLOSED<"[2019-08-01]" (I got this from here: http://jcardente.blogspot.com/2010/06/org-mode-hack-tasks-done-last-month.html.) The "CLOSED" part of the query does not seem to be working, and even if it was, I think filtering based on the Logbook would be safer. However, I after an hour of trying and finding nothing using Google, I figured asking is my best option.

  • No time to write up an answer, but I use the method documented here: doc.norang.ca/org-mode.html#Archiving -- a custom agenda that shows tasks suitable for archiving, then you just mark the ones you want with "m", then use the bulk commands to archive those (i.e. "B $" to archive). I like that because you get to choose what is archived so you can spot anything you'd like to leave out. I schedule a task to remind me to do this every month (with instructions for how to do it). – Stuart Hickinbottom Aug 26 at 8:52

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.