Hello all,

Sorry if my question is too easy, but I have no experience in elisp and emacs org-mode customization.

I've been trying to automatically archive done tasks to a sibling archive file but so far I've been unsuccessful.

Tasks should be archived if:
* They are done (and closed before a certain amount of time)
* All of its siblings are done (and closed before a certain amount of time)
* Parent doesn't have any todo keyword

For instance, my org file structure has the following structure:
* Tasks
 * TODO task1
 * DONE task2
* Projects
 * Personal
  * TODO personal project 1
   * TODO personal project 1 task 1
   * DONE personal project 1 task 2
  * DONE personal project 2
   * DONE personal project 2 task 1
   * DONE personal project 2 task 2
 * Professional
  * TODO professional project 1
   * TODO professional project 1 task 1
   * DONE personal project 1 task 2

I'd like function to archive tasks so that it leaves the following and archives the rest to sibling file:
* Tasks
 * DONE task2
* Projects
 * Personal
  * TODO personal project 1
   * TODO personal project 1 task 1
   * DONE personal project 1 task 2
 * Professional
  * TODO professional project 1
   * TODO professional project 1 task 1
   * DONE personal project 1 task 2

I tried org-my-archive-done-tasks code I found here:
http://www.mail-archive.com/emacs-orgmode@gnu.org/msg02939.html

However, I haven't succeed in making it archive anything in my setup.

How can I achieve this behaviour?

TIA,

Josep