({{, (RefLink[FileBaseName, paclet:ref/FileBaseName])["file"] 
gives the base name for a file without its extension.}})

OpenersNotesSection(Spacer1)Details and Options

(RefLink[FileBaseName, paclet:ref/FileBaseName])["name.ext"] gives "name".

(RefLink[FileBaseName, paclet:ref/FileBaseName]) drops all directory specifications.

(RefLink[FileBaseName, paclet:ref/FileBaseName]) by default assumes pathname separators and other conventions suitable for your operating system.

(RefLink[FileBaseName, paclet:ref/FileBaseName])[…,(RefLink[OperatingSystem, paclet:ref/OperatingSystem])->"os"] uses the conventions of the specified operating system. Possible choices are "Windows", "MacOSX", and "Unix".

(RefLink[FileBaseName, paclet:ref/FileBaseName]) just operates on names of files; it does not actually search for the file specified.

(RefLink[FileBaseName, paclet:ref/FileBaseName])[(RefLink[File, paclet:ref/File])["file"]] is also supported.

OpenersPrimaryExamplesSection(Spacer1)Examples  (6)

OpenersExampleSection0(Spacer1)Basic Examples  (2)

Find base name of the file:

FileBaseName["file.txt"]

Split off the last extension:

FileBaseName["file.tar.gz"]

OpenersExampleSection1(Spacer1)Scope  (3)

Leading directory names are dropped:

FileBaseName["/etc/init.d"]

Force interpretation of a file name as a Windows path:

FileBaseName["C:\\Windows\\System32",OperatingSystem->"Windows"]

Get the base name of the file specified by the (RefLink[File, paclet:ref/File]) object:

FileBaseName[File["file.txt"]]

OpenersExampleSection3(Spacer1)Possible Issues  (1)

The period is not considered part of the name, even if there is no extension:

FileBaseName["file."]

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[FileExtension, paclet:ref/FileExtension])  ▪  (RefLink[FileNameTake, paclet:ref/FileNameTake])  ▪  (RefLink[FileNameSplit, paclet:ref/FileNameSplit])  ▪  (RefLink[FileNameDepth, paclet:ref/FileNameDepth])  ▪  (RefLink[FileNames, paclet:ref/FileNames])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[String Manipulation, paclet:guide/StringManipulation])}, {▪(RefLinkPlain[Operations on File Names, paclet:guide/OperationsOnFileNames])}, {▪(RefLinkPlain[File Operations, paclet:guide/FileOperations])}, {▪(RefLinkPlain[Systems-Related String Operations, paclet:guide/SystemsRelatedStringOperations])}})}})