Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 

Repository files navigation

Windows File Name Rules

DOI

This repository contains a structured dataset in JSON format documenting invalid characters and reserved names for filenames on Windows. It is intended for developers, educators, or tool creators working on filename validation, cross-platform file handling, or automated sanitation of file input.

📦 Included Files

  • windows_filename_rules.json — the main dataset containing:
    • Invalid characters for Windows filenames
    • Character groupings (e.g., wildcards, path separators)
    • Reserved names (e.g., CON, LPT1)
  • file-names.ipynb — a Jupyter notebook to explore and test the rules programmatically
  • README.md — this file
  • LICENSECC0 1.0 Universal

📄 JSON Structure

{
  "table_of_characters": [...],
  "table_of_groups_of_characters": [...],
  "table_of_characters_in_groups": [...],
  "reserved_names": [...]
}

Each reserved name includes a reason explaining why it is disallowed on Windows. For example:

{ "name": "PRN", "reason": "Reserved device name: printer" }

✅ Example Use Case

You can use this data to:

  • Validate or sanitize filenames in cross-platform apps
  • Educate about filesystem rules
  • Run automated tests using tools like unittest or pytest

Example validation snippet (Python):

with open("windows_filename_rules.json") as f:
    data = json.load(f)

def is_reserved_name(name):
    return any(entry["name"].lower() == name.lower() for entry in data["reserved_names"])

💡 Why It Matters

Windows disallows certain characters and names regardless of file extension. These rules stem from legacy DOS device names and system-reserved syntax.

Examples of invalid names:

  • CON, NUL, AUX
  • COM1, LPT1
  • Names ending with space or period
  • Names containing characters like *, ?, |, "

📚 License

This project is dedicated to the public domain under CC0 1.0 Universal.

🔗 Related Publishing Options

This dataset is also suitable for publication on:

🔖 Citation

If you use this dataset, please cite it as:

Peter Cullen Burbery. (2025). Windows file name rules (v1.6.0). Zenodo. https://doi.org/10.5281/zenodo.16550141

About

Rules for valid and invalid Windows file names

Topics

Resources

Stars

Watchers

Forks

Releases

Packages

Contributors

Languages