walk a tree and callback with the paths sorted