Smartly Searching for Dates in Filenames with Total Commander (Regex)

In a previous blog, I showed how to rename files using regular expressions in Total Commander. This time, I’m tackling a different and very practical challenge.

Over the past 20 years of teaching, I’ve built up a large collection of text files containing my notes. They’re spread across a massive 12 TB hard disk, mixed in with many other files that aren’t relevant. Fortunately, there’s a clear pattern: the files I’m interested in always include a date in the filename.

That insight changes everything.

Instead of manually digging through thousands (or even millions) of files, I can focus on a much simpler goal:
👉 find only those .txt files that contain a date in their filename

Once I can reliably identify those files, I can quickly isolate exactly the notes I’m looking for, without wasting time on anything else.

In this article, I’ll show you how to use regular expressions (regex) in Total Commander to do just that.

The basic idea: detect a date in the filename

Let’s start with a practical and flexible regex that works in most situations:

^.*(19|20)\d{2}([._ -]?(0[1-9]|1[0-2])([._ -]?(0[1-9]|[12]\d|3[01]))?)?.*\.txt$

Example matches

✔ dv1_2007.txt
pp2_201505.txt
dv2_2020-05.txt
ssrs_2024-05-16.txt
dv2.2026_05_16.txt

1. Compact date (YYYYMMDD) or with separators

Use this if your files may contain either compact dates or dates with separators:

^.*((19|20)\d{2}(0[1-9]|1[0-2])(0[1-9]|[12]\d|3[01])|(19|20)\d{2}([._ -])(0[1-9]|1[0-2])\5(0[1-9]|[12]\d|3[01])).*\.txt$

20260516.txt
2026-05-16.txt
export_2026_05_16.txt

2. Minimal approach: just require a year

^.*(19|20)\d{2}.*\.txt$

backup_2024.txt
notes_2023_final.txt

How to use this in Total Commander

  • Open the search dialog with Alt + F7
  • Enter your regex in the “Search for” field
  • Enable “Regular expressions”
  • Start the search
Total Commander RegEx Search

Final thoughts

Just like with renaming files (as shown in my earlier blog), the real power of regex lies in recognizing patterns. Once you understand how your filenames are structured, you can quickly build expressions that pinpoint exactly the files you need. Combined with filtering, batch actions, and the multi-rename tool, Total Commander becomes an incredibly powerful solution for advanced file management.