Guide

How to rename files by the date inside the document, when every supplier writes it differently

You want 2026-03-04 Thompson Steel.pdf, using the invoice date printed on the page. Most pages on this topic rename by the date the file was created, which is a different job. The rest assume every document writes its date the same way. Here is how to do it properly, free methods first, and how to stop 3 April quietly becoming 4 March.

Short answer

Find the date by its label, such as Invoice Date, rather than taking the first date on the page, convert it to year, month, day, and flag any date like 03/04/2026 where the day and month could be swapped instead of guessing. For a small folder, doing it by hand with the file open is still the fastest reliable method.

First, which date do you actually mean

Windows, PowerToys PowerRename and most free renaming tools can put a date in a file name, but it is the date the file was created or modified. For a scan, that is the day you scanned it. For an emailed PDF, it is the day you saved it. If that is good enough, PowerRename is free, built by Microsoft, and will do the whole folder in a minute.

If you need the date printed on the document, nothing built into Windows or macOS can read it. You need something that looks inside the file, and before you choose a method, decide which printed date you mean. An invoice can carry an invoice date, a due date, a delivery date, an order date and the date the PDF was printed. A statement has a period and an issue date. Pick one, and write down the label your documents use for it.

The most common failure is not a misread date. It is the right date read from the wrong line, usually the due date, because it happened to come first.

Method 1: by hand, which is the right answer more often than people admit

For up to a few dozen files, open each one, read the date, and type the new name. With the file preview pane on in File Explorer, View then Preview pane, you can see the document and rename it without opening anything.

  1. 1Turn on the preview pane and sort the folder by name.
  2. 2Click a file, read the date you chose from the page, press F2, and type the name starting with the date as year, month, day, for example 2026-03-04 Thompson Steel.
  3. 3Keep the year first with a four digit year and two digit month and day. That is the only format that sorts correctly by name, and it cannot be misread by anyone in any country.

Slow, but you are the one reading the date, so you already know which line it came from and whether 03/04 means March or April. Every automatic method below has to solve those two problems some other way.

Method 2: a script, if the files have selectable text

Open a file and try to highlight the date with your mouse. If you can, the PDF has a text layer and a free script can read it. If you cannot, it is a scan, and you need OCR first, which our guide on renaming scanned documents covers.

The script is short. What makes it work or fail is how it reads the date, so here is what we found when we tested the popular Python date library, dateutil, on the formats suppliers actually use.

  1. 1Pull the text out of each PDF. PyMuPDF in Python or the free pdftotext command both do this.
  2. 2Find the label first, such as Invoice Date or Date of Issue, and take the date that follows it. Do not take the first date in the file.
  3. 3Convert that date by trying a fixed list of formats you have actually seen in your documents, one at a time, rather than letting a library guess.
  4. 4Rename the file with the date as year, month, day, and write every file you could not date into a list for review instead of skipping it silently.
  5. 5Run it on a copy of the folder, never the originals.
Telling the library that days come first can break ISO dates
Australian dates put the day first, so the obvious setting is dayfirst. We tested it, and with that setting dateutil read 2026-03-04, which is 4 March, as 3 April. The same setting read 03/04/2026 as 3 April, which is correct for an Australian invoice. One setting fixes one format and silently breaks another.
A missing day gets filled in for you
Given a period like March 2026, dateutil did not fail. It returned 28 March, because we ran the test on the 28th and it borrowed the day from today. A statement period renamed this way looks like a real date and is not.
Sept is not a month to strict parsers
Python's standard strptime rejected 14 Sept 2026, because it only accepts three letter month names, while dateutil accepted it. Plenty of Australian documents use Sept. Add it to your format list or replace it before parsing.
Two digit years have a cutoff
In Python's strptime, 68 becomes 2068 and 69 becomes 1969. That is fine for current invoices and wrong for old archives, so check the year range of your results.

Free, fast, and worth it for a regular flow from a few senders. Keep the format list explicit and short, and treat anything that does not match it as a file for a person to look at.

The day and month problem, and how to settle it

A date like 03/04/2026 cannot be settled from the characters alone. An Australian supplier means 3 April. An American one means 4 March. Software that picks one for you will be wrong on the other, and the result is a normal looking date that nobody questions.

When the day is 13 or more, there is no ambiguity, because there is no thirteenth month. The trouble is only dates where both numbers are 12 or under. These are the ones to settle, not guess.

Settle it by sender
Keep a short list of which suppliers write month first. Almost always it is overseas software companies, and there are only a few of them. Every other sender gets day first.
Settle it from another date on the same page
If the invoice also shows a due date of 17/04/2026, the document writes day first, so 03/04/2026 is 3 April. One unambiguous date on the page tells you how the rest are written.
Settle it against when you received it
An invoice usually arrives within days of its date. If the email came on 5 April, 3 April is plausible and 4 March is a month out. This is a sanity check, not proof, but it catches most swaps.
Otherwise, flag it
If none of those settle it, leave the file with a marker in the name, such as REVIEW, and look at it yourself. A dozen files to check by eye is a better outcome than a folder where some dates are silently a month off.

Method 3: a rule based renaming tool

File Juggler, Gillmeister's Automatic PDF Processor and Adobe Acrobat with plug-ins such as Evermap's AutoRename can all find a date inside a document and use it in a file name. They watch a folder and apply rules you set up.

File Juggler's own documentation shows it using the first date found in the document for its invoice date example, and it lets you choose a different position. Whichever tool you use, point it at the label, not the first date, and check how it handles day first dates before you trust it with a backlog. We have not tested these tools, so we cannot tell you how each treats 03/04.

A good answer when a few layouts arrive every week. Setting up rules for each layout is the part that takes the time, so it pays off on volume from repeat senders, not on a one off backlog from dozens of them.

Method 4: something that reads the document

The methods above all need you to tell them where the date is and how it is written. A reader that understands the page can find the invoice date by meaning, whatever the label says and wherever it sits, and that includes scans.

It still has to decide what 03/04 means. Ask any tool you consider what it does with a date that could be either way round. If the answer is that it just picks one, the checks above still apply. If your invoices go into Xero, QuickBooks or MYOB anyway, their built in capture reads the invoice date for you as part of the subscription you already pay, and you correct it beside the document, which is better than renaming files at all.

Worth it when a folder has many senders and many formats. For one supplier with one layout, a script or a rule is simpler and free.

Whichever you choose

Put the year first
2026-03-04 sorts correctly and reads the same everywhere. 04-03-2026 sorts by day, so the folder comes out in the wrong order across months.
Plan for two files on the same day
Date alone collides quickly. Add the supplier, and the invoice number if you have it, after the date. A good tool adds a suffix on a clash rather than overwriting.
Keep a record of the old names
Write a two column list of old name and new name before renaming. It costs nothing and it is the only practical way to undo a pass that went wrong.
Spot check the results
Sort the renamed folder and look at the first and last few files, and any date in the future. A swapped day and month often shows up as a date that has not happened yet.

Common questions

Can Windows rename files using a date inside the document?
No. File Explorer and PowerToys PowerRename can put the file's created or modified date in its name, but neither can read the contents. For the date printed on the page you need a script, a renaming tool that reads contents, or to do it by hand.
What date format should I use in file names?
Year, month, day with a four digit year, such as 2026-03-04. It is the only common format that sorts correctly by name, and it cannot be misread as the American or Australian order.
How do I stop 03/04 being read as the wrong month?
Do not let the software guess. Decide by sender, since most month first dates come from a handful of overseas companies, or use another date on the same page with a day of 13 or more to see which order the document uses. Anything you still cannot settle, flag and check by eye.
Why did my tool use the due date instead of the invoice date?
Most rules take the first date they find. On many invoices that is not the invoice date. Set the rule to look for the label your documents use, such as Invoice Date, and take the date after it.
Does this work on scanned documents?
Only after OCR, or with a tool that reads the image directly. A scan has no text for a script or rule to find, so the date has to be read from the picture first.

Related

Solven builds custom software and automation for Australian businesses. If you have a job like this that no tool quite fits, that is the work we do.

Get a free teardown