File Naming Conventions

XKCD comic about file naming
Source: https://xkcd.com/1459/

File Naming

LITS recommends that you name and organize your files in a way that indicates their contents and specifies any relationships to other files.

A file name should enable disambiguation among similar files and, for large numbers of files, facilitate sorting and reviewing. Ideally, file names should be unique.

Keep in mind that files can be moved and, without the inherited folder structure, important descriptive information about the contents could be lost. Consider whether a filename would be meaningful outside of your chosen directory structure, and if not, how important the loss of that context would be, e.g., if the date a file was created is important, include it in the filename rather than just the directory name.

The five precepts of file naming and organization
  1. Have a distinctive, human-readable name that gives an indication of the content.
  2. Follow a consistent pattern that is machine-friendly.
  3. Organize files into folders (when necessary) that follow a consistent pattern.
  4. Avoid repetition of semantic elements among file and directory names.
  5. Have a file extension that matches the file format (no changing extensions!)

To provide a description in the name itself of the file contents, you should include elements such as:

  • a date, or at least the year, when the contents of the file were created, in the YYYY-MM-DD format (four digit year, two digit month, two digit day, with a dash in between.)
    • Other date info: Sometimes the file contents concern a specific date or range of dates. If these need to be represented in the filename, use clear, concise designations, separated with hyphens rather than spaces. Avoid using ambiguous abbreviations; prefer putting the year first, followed by the rest of the date info. For example, “2019-Spring” rather than “Spring Sem. ‘19” or “SPSEM”.
  • the project name, or documented abbreviation for the project.
  • your organization or department’s name or abbreviation (if files are to be shared across organizations or departments.).
  • the location related to the contents of the file, such as city, research site, etc. (if important).
  • a version number, prefaced by v, or another indicator of the file content’s status such as draft or final or similar. For example, “Fiscal Report v2 draft”.
    • Avoid starting the filename with version number, “draft” or “final”.
Good Practice

The following guidelines will help make files more easily searchable, sortable, and readable.

  • Use the beginning of the filename for the most salient information. If the date is most important, put that first; if the department is most important, put that first; etc.
  • Avoid ambiguous abbreviations (“ST” could be “street”, “saint”, “state”, “standard”, “speech therapy”, “Star Trek”, etc.). When in doubt, spell it out.
  • Do not use special characters (e.g., * . ” / \ [ ] : ; | = , < ? > & $ # ! ‘( ) { }).
  • Avoid using “camel caps” (e.g., “PelletierLibraryPublicServices”) — use spaces or underscores between words instead (“Pelletier Library Public Services” or “Pelletier_Library_Public_Services”).
  • Use hyphens to connect closely-tied units of information, such as dates: 2019-08-08 Library Budget Update.
  • If the date is included, write this in numbers: YYYY-MM-DD. For example, use “2017-01-10” rather than “January_10th”.
  • If numbering files, consider how many potential files are needed and use the appropriate number of leading zeros: 001, 002, etc., will order files up to 999.
  • DO NOT WRITE ENTIRE FILE NAME IN CAPITALS AS THIS IS HARD TO READ.