KeyRoutines
StepFreelist.sort

Sort a list A to Z or by size or name in a routine

Sort list puts the items of a list in order, A to Z or Z to A. For lists of dictionaries, like file details, you can sort by one field such as name or size.

How it works

  • Pass a list of text, numbers or dates and pick the order: A to Z (smallest first) or Z to A (largest first).
  • For a list of dictionaries, set the advanced Sort by field.
  • A list that mixes kinds, such as numbers and text, is refused with a clear message.
  • It returns the sorted copy and its count.

Routines that use it

Biggest files first

Sort the results of List files by size, Z to A, and show the top one with Get list item.

Alphabetical menu

Sort names before offering them in Choose from a list.

Oldest backup

Sort backup dates A to Z and recycle the first with Delete to Recycle Bin.

Settings

SettingWhat it does
ListThe list to sort: text, numbers or dates.
OrderA to Z (smallest first) or Z to A (largest first).
ByadvancedFor a list of dictionaries: sort by this field, such as name or size.

Good to know

  • All items must be the same kind; a mix of numbers and text can't be sorted.

Questions

Can I sort files by size in KeyRoutines?
Yes. Pass the list from List files and set Sort by to the size field.
How do I sort largest first?
Choose Z to A, which puts the largest numbers and latest dates first.

Pairs well with

Build this routine in KeyRoutines

Free from the Microsoft Store for Windows 11 and 10. Pro is a one-time upgrade.