Sort files and pack them into partitions