Filenames and file types
Stay organized with collections
Save and categorize content based on your preferences.
Guidelines for names
Make file and directory names lowercase, with the occasional exception for consistency, to make file searches easier and search results more useful. For example, because most Unix-style operating systems are case sensitive, they can't find a file named Impersonate-Service-Accounts.html
if you search for impersonate-service-accounts.html
. Linux and macOS interpret these as two distinct files.
Use hyphens, not underscores, to separate words—for example,
query-data.html
. Search engines interpret hyphens in file and directory names as spaces between words. Underscores are generally not recognized, meaning that their presence can negatively affect SEO.
Use only standard ASCII
alphanumeric characters in file and directory names.
Don't use generic page names such as document1.html
.
Exceptions for consistency
If you're adding to a directory where everything else already uses
underscores, and it's not feasible to change everything to hyphens, it's okay to
use underscores to stay consistent.
For example, if the directory already has lesson_1.jd
,
lesson_2.jd
, and lesson_3.jd
, it's okay to add your
new file as lesson_4.jd
instead of lesson-4.jd
.
However, in all other situations, use hyphens.
Recommended: avoiding-cliches.jd
Sometimes OK: avoiding_cliches.jd
Not recommended: avoidingcliches.jd
Not recommended: avoidingCliches.jd
Not recommended: avoiding-clichés.jd
Other exceptions
It's okay to have some inconsistency in filenames if it can't otherwise be
avoided. For example, sometimes tools that generate reference documentation
produce filenames based on different style requirements or based on the design
and naming conventions of the product or API itself. In those cases, it's okay
to make exceptions for those files.
Refer to files
The following sections discuss how to reference files.
Refer to filenames
When referring to a specific file, do the following:
- Use code font.
- Include the word file after the filename. For more information, see
Grammatical treatment of code elements.
- Use the exact spelling of the filename even if it doesn't follow
naming guidelines.
- If a sample of the file is included on the page, follow the
code sample
guidelines and precede a code sample with an introductory sentence or paragraph that includes the
filename.
Recommended: In the following
build.sh
file, modify the default values for all parameters:
Refer to file interactions
When interacting with files and file types, don't use the file types as a verb.
Recommended: Extract a zip file.
Not recommended: Unzip a zip file.
Refer to file types
When you're discussing a file type, use the formal name of the type, not the filename extension.
(The file type name is often in all caps because many file type names are acronyms
or initialisms.) Do not use the filename extension to refer generically to the
file type.
Recommended: a PNG file
Not recommended: a .png
file
Recommended: a Bash file
Not recommended: an .sh
file
The following table lists some examples of filename extensions and the
corresponding file type names to use.
Extension |
File type name |
.adoc |
AsciiDoc file |
.csv |
CSV file |
.exe |
executable file |
.gif |
GIF file |
.img |
disk image file |
.ipynb |
IPYNB file |
.jar |
JAR file |
.jpg , .jpeg |
JPEG file |
.json |
JSON file |
.md |
Markdown file |
.pdf |
PDF file |
.png |
PNG file |
.ps |
PowerShell file |
.py |
Python file |
.sh |
Bash file |
.sql |
SQL file |
.svg |
SVG file |
.tar |
tar file |
.tf |
Terraform file |
.tiff |
TIFF file |
.txt |
text file |
.yaml |
YAML file |
.zip |
zip file |
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-10-15 UTC.
[null,null,["Last updated 2024-10-15 UTC."],[[["\u003cp\u003eUse lowercase, hyphens, and standard ASCII characters for file and directory names for better search engine optimization and compatibility across operating systems.\u003c/p\u003e\n"],["\u003cp\u003ePrioritize consistency with existing naming conventions within a directory when adding new files, even if it means deviating from the general guidelines.\u003c/p\u003e\n"],["\u003cp\u003eWhen referencing files, use code font, include the word "file", and maintain the exact spelling of the filename.\u003c/p\u003e\n"],["\u003cp\u003eWhen discussing file types, use their formal names instead of filename extensions (e.g., "PNG file" instead of ".png file").\u003c/p\u003e\n"]]],["File and directory names should be lowercase, using hyphens to separate words (e.g., `query-data.html`). Exceptions for consistency within existing directories are acceptable. Use only standard ASCII alphanumeric characters and avoid generic names. When referring to files, use code font, include the word \"file,\" and maintain exact spelling. Don't use file types as verbs. Refer to file types by their formal names, not by their extensions (e.g., \"PNG file,\" not \".png file\").\n"],null,["# Filenames and file types\n\nGuidelines for names\n--------------------\n\nMake file and directory names lowercase, with the occasional exception for consistency, to make file searches easier and search results more useful. For example, because most Unix-style operating systems are case sensitive, they can't find a file named `Impersonate-Service-Accounts.html` if you search for `impersonate-service-accounts.html`. Linux and macOS interpret these as two distinct files.\n\nUse hyphens, not underscores, to separate words---for example,\n`query-data.html`. Search engines interpret hyphens in file and directory names as spaces between words. Underscores are generally not recognized, meaning that their presence can negatively affect SEO.\n\nUse only standard ASCII\nalphanumeric characters in file and directory names.\n\nDon't use generic page names such as `document1.html`.\n\n### Exceptions for consistency\n\nIf you're adding to a directory where everything else already uses\nunderscores, and it's not feasible to change everything to hyphens, it's okay to\nuse underscores to stay consistent.\n\nFor example, if the directory already has `lesson_1.jd`,\n`lesson_2.jd`, and `lesson_3.jd`, it's okay to add your\nnew file as `lesson_4.jd` instead of `lesson-4.jd`.\nHowever, in all other situations, use hyphens. \nRecommended: `avoiding-cliches.jd`\n\nSometimes OK: `avoiding_cliches.jd`\n\nNot recommended: `avoidingcliches.jd`\n\nNot recommended: `avoidingCliches.jd`\n\nNot recommended: `avoiding-clichés.jd`\n\n### Other exceptions\n\nIt's okay to have some inconsistency in filenames if it can't otherwise be\navoided. For example, sometimes tools that generate reference documentation\nproduce filenames based on different style requirements or based on the design\nand naming conventions of the product or API itself. In those cases, it's okay\nto make exceptions for those files.\n\nRefer to files\n--------------\n\nThe following sections discuss how to reference files.\n\n### Refer to filenames\n\nWhen referring to a specific file, do the following:\n\n- Use [code font](/style/code-in-text).\n- Include the word *file* after the filename. For more information, see [Grammatical treatment of code elements](/style/code-in-text#grammatical-treatment-of-code-elements).\n- Use the exact spelling of the filename even if it doesn't follow [naming guidelines](#naming-guidelines).\n- If a sample of the file is included on the page, follow the [code sample](/style/code-samples) guidelines and precede a code sample with an introductory sentence or paragraph that includes the filename.\n\nRecommended: In the following\n`build.sh` file, modify the default values for all parameters:\n\n### Refer to file interactions\n\nWhen interacting with files and file types, don't use the file types as a verb.\n\nRecommended: Extract a zip file.\n\nNot recommended: Unzip a zip file.\n\n### Refer to file types\n\nWhen you're discussing a file type, use the formal name of the type, not the filename extension.\n(The file type name is often in all caps because many file type names are acronyms\nor initialisms.) Do not use the filename extension to refer generically to the\nfile type.\n\nRecommended: a PNG file\n\nNot recommended: a `.png`\nfile\n\nRecommended: a Bash file\n\nNot recommended: an `.sh`\nfile\n\nThe following table lists some examples of filename extensions and the\ncorresponding file type names to use.\n\n| Extension | File type name |\n|-----------------|-----------------|\n| `.adoc` | AsciiDoc file |\n| `.csv` | CSV file |\n| `.exe` | executable file |\n| `.gif` | GIF file |\n| `.img` | disk image file |\n| `.ipynb` | IPYNB file |\n| `.jar` | JAR file |\n| `.jpg`, `.jpeg` | JPEG file |\n| `.json` | JSON file |\n| `.md` | Markdown file |\n| `.pdf` | PDF file |\n| `.png` | PNG file |\n| `.ps` | PowerShell file |\n| `.py` | Python file |\n| `.sh` | Bash file |\n| `.sql` | SQL file |\n| `.svg` | SVG file |\n| `.tar` | tar file |\n| `.tf` | Terraform file |\n| `.tiff` | TIFF file |\n| `.txt` | text file |\n| `.yaml` | YAML file |\n| `.zip` | zip file |"]]