---
name: archive-file-names
description: "Plan a reversible rename of scanned documents to a dated naming convention, using the date on the document, and catch collisions and swap conflicts before any file is touched. Use when someone wants to rename a folder of scans, photos or digitised papers consistently."
license: CC-BY-4.0
metadata:
  author: Raq.com
  version: "2026-11-22"
  homepage: https://skills.raq.com/skills/archive-file-names
---

# Plan consistent names for a folder of archive scans

Build a reversible rename list for scanned documents and flag collisions before touching any originals.

## When to use this skill

- Someone has a folder of scans with scanner or camera names, such as IMG_0042.JPG or scan001.tif, and wants consistent dated names.
- An archive or family collection needs file names that sort by document date and include an item identifier.
- Names are being changed on a case-insensitive drive, or two files need to swap names, and nothing may be overwritten.

## When not to use it

- Cataloguing or describing the documents. File names help retrieval; descriptions belong in a catalogue or metadata record.
- Running the rename. This skill produces a dry-run manifest for the person or a script to apply after review.
- Dating an undated document from its content. Mark the date unknown, or ask an archivist to assess it.

## What you need

- Current filenames, known document dates, document type, item identifiers and naming convention.

## Ask before you start

If any of these are missing or unclear, ask before doing the work.

- What naming convention should be used, such as YYYY-MM-DD_type_id.ext? Agreeing it first avoids renaming twice.
- Where does each document's date come from: the date written on it, a catalogue record, or nowhere? The scan date is not the document date.
- Which drive and operating system will hold the files? Windows, and macOS drives formatted as case-insensitive, treat names that differ only in case as the same file.
- Are there other files in the destination folder that are not being renamed?

## Method

1. Fix the convention before proposing names: ISO 8601 dates (YYYY-MM-DD) so names sort by date, then document type, item identifier and extension, using only lowercase letters, digits, hyphens and the _ character, with no spaces or other punctuation.
2. Take the date from the document or its catalogue record. If there is none, keep the date unknown and hold the file; never substitute the scan date or the file's modified date.
3. Propose each new name in a side-by-side manifest: old name, new name and where each part came from. Keep the file's extension, in lowercase.
4. Normalise names for comparison, by lowercasing and applying Unicode normalisation, then check for collisions among the proposed names and against existing files in the destination that are staying where they are.
5. Hold every file involved in a collision, not just the second one, and say what detail would tell them apart, such as a sheet number or a distinct identifier.
6. Tell apart a true collision (two files want the same final name) and a temporary conflict (a final name is currently held by another file in the batch). For swaps, cycles and case-only changes, plan a first pass to unique temporary names on the same volume, checked against the whole directory, then a second pass to the final names.
7. Never overwrite a file outside the selection. Keep the manifest as the record of the change so it can be reversed.

## Checks before you deliver

- Two scans on one date can still be separate originals.
- Lowercasing on a different filesystem can collapse distinct names.
- Using the scan date because it is in the file metadata. It records when the copy was made, not when the document was written.
- Renaming A to B before the existing B has moved, which overwrites B.
- Using characters some systems reserve, such as a colon, slash or question mark, or ending a name with a space or full stop, which Windows does not support.

## How to present the result

Start with how many files can be renamed now and how many are held. Then give the manifest as a table: old name, proposed name and the source of the date. List held files with the reason and the detail needed to resolve each. If staging is needed, give the two-pass order explicitly. Hand back the manifest for review, not a script that has already run.

## Worked example

**Request:** Prepare a dry-run manifest.

**Supplied material:**

```text
x001.JPG: letter dated 1964-10-02, id A7, scanned 2026-11-01. x002.JPG: receipt, id R9, no document date.
```

**Answer:** Proposed rename: x001.JPG → 1964-10-02_letter_a7.jpg.
Hold x002.JPG. It is receipt R9, but its document date is unknown. The scan date cannot supply the missing date.

## Structured output for tests

For an ordinary job, answer in the format above and point back to the supplied evidence. Use this structure only for the test cases published with this skill, or when someone asks for structured JSON.

For the fixtures propose YYYY-MM-DD_kind_id.ext in lowercase with the supplied kind and ID. Return rename as an object old name to new, and hold as original names in input order for missing dates or collisions. Withhold all sides of a collision. If asked to flag staged renames, also return stage as original names that must first be moved to temporary names for the proposed two-phase plan.

## Sources

- [US National Archives: NARA Bulletin 2015-04, Appendix B, file naming](https://www.archives.gov/records-mgmt/bulletins/2015/2015-04-appendix-b.html): Advises platform-independent file and folder names using only letters a to z, digits 0 to 9, hyphens and the _ character, with no spaces, and keeping components such as dates in the same position in every name.
- [US National Archives, Records Express: best practices for file naming](https://records-express.blogs.archives.gov/2017/08/22/best-practices-for-file-naming/): Published by NARA's Chief Records Officer, it recommends ISO 8601 date notation (YYYY-MM-DD), unique and consistently structured names, leading zeros in sequence numbers and avoiding punctuation.
- [Microsoft Learn: naming files, paths and namespaces](https://learn.microsoft.com/en-us/windows/win32/fileio/naming-a-file): Says not to assume case sensitivity, because names such as OSCAR, Oscar and oscar are the same by default, lists reserved characters and device names, and says names should not end with a space or full stop.

Test cases and an answer checker for this skill: https://skills.raq.com/skills/archive-file-names
