6

I just realized I don't know how file is called in file.ext.

The whole file.ext is called a file or filename, ext is called extension but how do you call the file part itself of file.ext?

For example happy-dog.png. All the file/filename is happy-dog.png, extension is png but how do you call happy-dog?

It's not basename. Is it like titlename? Or filepart? Any ideas?

bodacydo
  • 312
  • 1
  • 3
  • 10

3 Answers3

4

I doubt there is a stable terminology here. A small googling exposes people utilize base name for this, but this usage conflicts with the same term used as "full file name without path". For example, https://stackoverflow.com/questions/2183486/ exposes the case when "filename" is "basename" plus "extension".

OTOH, the term "extension" you use is weird. It's originated in CP-M/Dos/Windows world (distorting imitation of RSX-11/RT-11 approach) where a file name could (before Windows 95) have a single part after dot. In Unix world, this was being named "suffix" from the very beginning, and I would strongly suggest you using this term. The difference is that multiple suffixes can exist - for example, a.o.d is dependency list for a.o. In turn, if this is suffix, the part before suffixes is a filename root. In my opinion, there is too small chance to get it conflicting with "root" as Unix superuser.

UPD: linguistics often use "stem" in a vast sense "part before ending and, sometimes, before suffix". But I see mention for "root" in neighbor reply, so, seems "root" is good until you need further distinction.

Netch
  • 2,469
  • 17
  • 11
  • Note that for ODS-2, the on-disk filesystem layout used by the VMS operating system, the "extension" was actually a separate part of the inode-moral-equivalent ("file header", I think). I'm pretty sure that was the case for MS-DOS "FAT" filesystems, and I believe it's still the case for NTFS, which is a whole lot like ODS-2 on disk. –  Dec 01 '15 at 16:35
2

csh, tcsh,vim and zsh which have an operator to extract that part of the file name ($file:r) call it the root name or root of the file name (well, $file:r applied to /foo/bar.baz is /foo/bar, so bar would rather be the root of the basename or the basename of the root). Erlang also has a rootname() operator and the python documentation also refers to the file path without the extension as the root.

That may not be very common practice (I long thought myself r was for rest of the file name and web search engines don't bring up a lot of references) but that's a long-standing one since that feature was already there and documented as such in the first publicly released version of csh in 1979.

Stéphane Chazelas
  • 522,931
  • 91
  • 1,010
  • 1,501
2

I quite like Python's pathlib terminology of stem. This is consistent with natural language processing terminology, but I don't believe this is universal.

Gilly
  • 147
  • 4