4

Take the following file name:

Example.txt

Is there any term for the name "Example", as opposed to "Example.txt"? Either one of those two can be referred to as the "file name", although as Kristina Lopez seemed to suggest in the comments, it can be helpful at times to use "file name" to refer specifically to the part before the extension.

Is there a general word that is specific to that interpretation, and if so, what would it be? This doesn't have anything to do with the folder path of the file, just the name of the file itself.

My research is currently showing that there's likely no standard name for this (although certain entities may have their own phrases that they use). In .NET, for instance, the function Path.GetFileNameWithoutExtension doesn't really use any special terminology, and almost exactly the same phrase is used in various other contexts.

To follow the rule for the single-word-requests tag, this sample sentence is included:

We need the software to provide two separate options for a file name, one for the <"base name">, and one for the extension.

Semi-standard words are fine, but not anything that's specific to one particular framework, company, etc.

5
  • 3
    It is actually called "basename", e.g., stackoverflow.com/questions/2235173/…
    – jimm101
    Commented Jan 4, 2018 at 19:24
  • @jimm101 The first couple of answers seem to suggest that being used to refer to "Example.txt". Commented Jan 4, 2018 at 19:27
  • 1
    @Panzercrisis I clarified and put an answer. The premise is wrong--extensions aren't recognized as meaningful on every OS.
    – jimm101
    Commented Jan 4, 2018 at 19:30
  • 3
    This is not an English question, but rather a programming question.
    – tchrist
    Commented Jan 4, 2018 at 19:34
  • It's both English and programming. It's asking for an English term related to programming. In another human language, the term would change. Commented Jan 22, 2020 at 17:05

2 Answers 2

4

Generally, basename is correct.

Not all OSes consider the basename.txt format to be meaningful. In older MS/IBM DOS and Windows, the format was 8.3, which was 8 characters followed by a dot followed by 3 characters. Unix/linux doesn't do this--the '.' is just an acceptable character. So there likely isn't much of a "standard" term, although many languages refer to a basename concept for decomposing filenames.

1
  • Actually there is a basename command which removes the "path", but also (optionally) a given suffix. Commented Jan 4, 2018 at 21:02
3

basename is the file name without its directory. But it may or may not include the file extension, so it's ambiguous. The basename Unix command has an option for whether the extension should be removed. Here's a related Stack Overflow question where people disagree over whether basename includes the extension, depending on the tools.

stem is the name of the file that never includes the file extension. It's used in C++, Python, Rust, and LLVM.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.