Mathematica 9 is now available
THIS IS DOCUMENTATION FOR AN OBSOLETE PRODUCT.
SEE THE DOCUMENTATION CENTER FOR THE LATEST INFORMATION.
Mathematica > Core Language > String Manipulation > Operations on File Names > FileExtension >
Mathematica > Systems Interfaces & Deployment > File Operations > Operations on File Names > FileExtension >
Mathematica > Systems Interfaces & Deployment > File Operations > Directories & Directory Operations > Operations on File Names > FileExtension >

FileExtension

FileExtension
gives the file extension for a file name.
  • FileExtension gives the extension that appears after the last in a file name.
  • If there are multiple endings to a file name, separated by , FileExtension gives only the last one.
  • FileExtension gives if there is no file extension, if the file name has the form of a directory name, or ends with a character.
  • FileExtension by default assumes pathname separators and other conventions suitable for your operating system.
  • FileExtension just operates on names of files; it does not actually search for the file specified.
Find the file extension of a string:
Find the file extension of a string:
In[1]:=
Click for copyable input
Out[1]=
The period is not part of the file extension:
Or the file base name:
New in 7
Ask a question about this page  |  Suggest an improvement  |  Leave a message for the team
Format:   HTML  |  CDF