Various polymer properties are directly affected by the presence of knots, such as tensile strength, elastic response and pore translocation capabilities. An important step for understanding these effects is comparing chains properties with different topological state and this, in turn, depends on the possibility of sorting ring polymers by topology. In this theoretical study we discuss a novel method for sorting ring polymers according to their topological, knotted state. The proposed approach harnesses the rich dynamical behaviour of polymers confined inside spatially-modulated nanochannels. The longitudinal mobility of the rings is shown to have two key properties that are ideally suited for knot sorting. First, at fixed topology, the mobility has an intriguing oscillatory dependence on chain length. Second, the mobility ranking of different knot types is inverted upon increasing the chain length. We show that this complex interplay of channel geometry, chain length anf topology can be rationalised within a simple theoretical framework based on Fick-Jacob's diffusive theory. The results and the interpretative scheme ought to be useful for designing microfluidic devices with optimal topological sorting capabilities.