Skip to main content

Answers for companies

The business Knowledge Base is currently being revised. Soon you will find updated content and expanded information here, giving you an even better overview of our products and services. We thank you for your patience and understanding.

Please note: The Knowledge Base has changed slightly. Categories have been adjusted and any URLs stored in the old Knowledge Base are no longer valid.

Alphanumeric sorting of files

File Sorting in Drive

The file manager in Drive uses alphanumeric sorting to display files. It interprets the characters in the file name as a string, which is evaluated sequentially. A "1" always comes before a "2", and a "2" comes after an "11". This can lead to unexpected effects, such as the following sorting order:

1_Invoice-January.pdf
11_Invoice-November.pdf
12_Invoice-December.pdf
2_Invoice-February.pdf


Figure 1: Single-digit numbering is not a good idea. Leading zeros solve the problem.

If you want to display these invoices sorted by month, it helps to add the month number at the beginning of the file name in two-digit notation (that is, with a leading zero):

01_Invoice-January.pdf
02_Invoice-February.pdf
11_Invoice-November.pdf
12_Invoice-December.pdf


Figure 2: Invoices or similar files can be sorted easily by month.


Figure 3: For letters, alphabetical order applies.

If you want to store and display a larger number of files in sorted order, it is advisable to start with two (or more) leading zeros, for example 001-Invoice-Customer1.pdf. This allows space for up to 999 entries.