My emacs org-mode agenda files are steadily growing, and many of my projects span several to many years. In addition, I need to last access the entries after about a year. Hence rather than (or in addition to) archiving my agenda entries per project, I would like to archive all my agenda entries from a given date range, for example (half) a calendar year. Is this possible somehow? Since I need to do this once or twice a year, it isn't too bad if I need more than a few keystrokes for this action (which I could stick in a macro anyway). Even if the solution would only work for a given month or calendar year, rather than any random date range, it would help me.

My work agenda file has a structure like below. I would like that structure to be kept in the archive file, in case I ever need to figure out how much time I spent on a given project or on all my teaching years later.

* Research
** Project 1
** Project 2
** Project N
* Teaching
** Class 1
** Class 2
  • 2
    How about conducting a search for a specific date range, then mark the ones within that search result that you want to archive (or all of them), and then archive them? Here is a link to some advanced searching techniques from the manual: orgmode.org/worg/org-tutorials/advanced-searching.html See also the agenda individual / bulk marking commands in the manual: orgmode.org/manual/Agenda-Commands.html – lawlist Oct 3 '20 at 15:32
  • @lawlist That looks pretty powerful. However, I was hoping to keep the structure from the original file in my archive file. I hadn't realised sufficiently how essential that is to my wishes and hadn't specified it in the question, so I just added it. – AstroFloyd Oct 23 '20 at 19:40

I created a command-line tool written in Python called org-agenda-archive that (crudely) does what I wanted and published it on GitHub.

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.