Current org file
* TODO test
** TODO test 1
** TODO test 2
** DONE test 3
* DONE test 4
** DONE test 5
The expected output to current file
* TODO test
** TODO test 1
** TODO test 2
** DONE test 3
Archive file
* DONE test 4
** DONE test 5
I used the agenda mode way to archive, ie C-c a t N r (mark items) B $
but that moved the item ** DONE test 3
as well.
I found an alternative technique to achieve similar results.
C-^ O // order by todo order
C-c $ // archive
C-x z // repeat previous command
z // repeat
z
z