After-the-dot-in-a-file-name, it is called extension.
Asked
Active
Viewed 8,272 times
19
-
http://www.googlefight.com/index.php?lang=en_GB&word1="filename+and+extension"&word2="basename+and+extension" – Nosredna Jul 07 '09 at 20:20
-
I think Googlefight is broken. It says "Basename and extension" wins, even though "Filename and extension" beats it by a 30 to 1 ratio on an ordinary Google search. – Robert Harvey Jul 07 '09 at 20:25
-
I see the StackOverflow police have found us. :O – Robert Harvey Jul 07 '09 at 20:28
-
@Robert Harvey. I see 12700 results for "filename and extension" and 833 results for "basename and extension" – Nosredna Jul 07 '09 at 20:41
-
Interesting. I'm getting 27100 for "filename and extension... – Robert Harvey Jul 07 '09 at 20:45
-
... and now I'm getting 170,000 for "basename and extension" ?! – Robert Harvey Jul 07 '09 at 20:46
-
Haha. Now I'll know what to suggest the next time someone asks for a random number generator. :-) – Nosredna Jul 07 '09 at 20:54
10 Answers
25
It's called the basename. In fact, there's a unix/linux command for it:
basename - strip directory and suffix from filenames

skaffman
- 398,947
- 96
- 818
- 769
-
2The `basename` I have only removes the suffix if you specify exactly what you want removed; it does not remove a suffix by default. – Greg Hewgill Jul 07 '09 at 19:58
-
-
`"The basename I have only removes the suffix if you specify exactly what you want removed"` - yeh, PHP is not very consistent with this :( – gingerCodeNinja Jan 31 '18 at 18:00
5
The "base name," "basename," "primary name," "filename," "file name," or the "file."

Nosredna
- 83,000
- 15
- 95
- 122
-
-
4I'd never use "filename" and "basename" interchangeably. They mean different things. – skaffman Jul 07 '09 at 20:02
-
2I don't really agree with filename or file name. Don't most OS' consider the extension to be part of the filename? – Brandon Jul 07 '09 at 20:03
-
I hear "type the filename and the extension" all the time. It's a very common usage. – Nosredna Jul 07 '09 at 20:05
-
2I think the confusion comes from the ambiguousness of filename. In `c:/program.exe`, filename either refers to `Program` or the entire string as a whole. – GManNickG Jul 07 '09 at 20:08
-
-
2Historically, some systems have mandatory extensions and some have optional extensions. When the extension is mandatory, it can be seen as metadata, and the basename and the filename are the same thing – Nosredna Jul 07 '09 at 20:16
1
I've always called the everything before the dot and the extension the "file name".

Thomas Owens
- 114,398
- 98
- 311
- 431
1
I'm not a Ruby or Linux guy, so I guess I missed the BaseName thing. It makes for all sorts of interesting naming convention hilarity. I'm in the
Filename.Ext
camp, although that, too can be a FileName. (or maybe a FileNameWithExtension).

Robert Harvey
- 178,213
- 47
- 333
- 501
1
Once upon a time, the term Leafname was used, although that typically included the extension. I mention this for historical value, and since its dropped out of usage, it might be redeemable for this purpose.

Dave Gamble
- 4,146
- 23
- 28