Iterate over files and directories in a stable order.

This avoids spurious diffs caused by generating e.g. the Maktaba flags in an unpredictable order.

Fixes #75.