Naming Date-Based Files for Easy Retrieval

Q    I create a lot of documents for work.
I have been trying to come up with a way
to keep them organized, and the earlier Q&A on
creating folders helped some. The problem I have now
is that the files with numbers in the names don’t
sort properly in the file list. I get 11 before 2, and so
on. Why is that, and is there some way to fix it?
— J.D.


A    The problem you are seeing with file sorting
has to do with the fact that Windows
treats numeric digits in file names as characters.
Numeric digits are just characters that have a lower sorting
priority than the letters of the alphabet. For
example, suppose you have a report that you always
name Monthly Status with the month and year
appended like this:

Monthly Status 1-2000.doc

Monthly Status 10-2000.doc

Monthly Status 11-2000.doc

Monthly Status 12-2000.doc

Monthly Status 2-2000.doc

… [files for months 3-8]

Monthly Status 9-2000.doc

Two things are wrong with this approach. The
first problem is that your October through
December documents appear after January instead of after
September. Why? Because 1 sorts lower than 2, so all
the names with a 1 in 16th character position in
the filename sort before names with a 2 in the
16th position. You won’t see the second problem until
2001, when the January 2001 status document falls
between your January 2000 document and your October 2000 document. That’s probably not what
you want to see happen.

When you are trying to get file names to sort
correctly, start at the leftmost character and work
right. To fix the problems, you must do two things:
First, put the year before the month and always use a
full four-digit year. Second, always use a
two-digit month, with a zero preceding single-digit months.

So, the new file list looks something like this:

Monthly Status 2000-01

… [files for months 2-8]

Monthly Status 2000-09

Monthly Status 2000-10

Monthly Status 2000-11

Monthly Status 2000-12

In 2001, your January status document will
follow all the 2000 documents as it should. Using a
consistent naming convention helps you organize your
files and makes it easier to find those files later.