sort files inside directory trees, fixes #1487