FileFormat

FileFormat["name"]

attempts to determine what Import format could be used to import the file corresponding to "name".

Details

  • FileFormat returns a format name of the type used by Import.
  • FileFormat uses heuristic methods, and may not give correct results, particularly for shorter files.
  • FileFormat does not verify that Import would succeed if applied to "name".
  • FileFormat gets clues from both names of files and properties of files recorded in the filesystem, but bases the final result it returns only on the actual contents of files.
  • FileFormat[File["name"]] is also supported.

Examples

Basic Examples  (2)

The Import format of a file:

In[1]:=
Click for copyable input
Out[1]=

A format name of the type used by Import:

In[1]:=
Click for copyable input
Out[1]=

See Also

FileExtension  StringFormat  Import  BinaryReadList  FileHash

Introduced in 2007
(6.0)