Quantcast
Viewing all articles
Browse latest Browse all 186

How to separate a filename from its extension [closed]

Is there a function that separates a filename from the extension? E.g.

MyNotebook.nb

would become

{ "MyNotebook", ".nb" }

I looked at FileNameSplit[], but that leaves "MyNotebook.nb" as the last element.

InputForm[StringSplit[Last[FileNameSplit[NotebookFileName[]]], "."][[1]]]

works, but is rather convoluted, and also fails if the filename itself contains a dot. Any ideas?


Viewing all articles
Browse latest Browse all 186

Trending Articles