I haven't done too much testing either but for me it seems to work, I but the MoveToEndOfDisk()
in the first zone and put MakeGap(0)
right after and it seems to work correctly.
Ah! Thanks, with MakeGap(0) it works. Again, no mention of a need to "reset" the "pointer" after using MoveToEndOfDisk() in the manual, so I assumed it's taken care of automatically. Actually, without autoreset to the end of previous zone things look really messy in the boolean select, 'cause we have to exclude all the zones that go in the beginning (assuming we use MakeGap(0)), and if they already have long boolean expressions... it's not pretty. I think really there should be autoreset to the end of previous zone. Otherwise it's only faster than the previous MakeGap(MaxNextZone) approach, not cleaner. Also, mentioned previous approach optimizes in one pass (though slow while initial migration to the end is going on), while this new can't move unselected files down from the end of disk, so it could take anywhere from 1 to quite a number of passes (while also generating space fragmentation).
Essentially, it works good only if freespace is consolidated already (and is plentyful).
P.S. Or am I missing something? Maybe I can use something like
<files to the end>