FileExtension

FileExtension["file"]
gives the file extension for a file name.

Details and OptionsDetails and Options

  • FileExtension["name.ext"] gives .
  • 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 ignores any directory specification.
  • FileExtension by default assumes pathname separators and other conventions suitable for your operating system.
  • FileExtension[..., OperatingSystem->"os"] uses the conventions of the specified operating system. Possible choices are , , and .
  • FileExtension just operates on names of files; it does not actually search for the file specified.
New in 7
New to Mathematica? Find your learning path »
Have a question? Ask support »