FileConvert

Listing of Formats »

FileConvert[source"dest.ext"]

converts the contents of source to the format defined by the extension ext and writes the result to the file dest.ext.

FileConvert[source,"format"]

writes the result to the filename defined by source, but with an extension defined by the specified format.

FileConvert[source"dest.ext","format1""format2"]

takes the contents of source to be in the specified format "format1".

Details and Options

Examples

open allclose all

Basic Examples  (2)

Convert a CSV file to TSV:

Convert a GIF to PNG, specifying a new filename:

Scope  (10)

Basic Uses  (4)

When no format is specified, FileConvert attempts to infer the format from the output file extension:

Specify the output file format:

When the output filename is not specified, the same filename is used with the new extension:

Specify the input and output formats:

Format Types  (6)

3D  (1)

Convert an OBJ file to STL:

Audio  (1)

Convert a WAV file to MP3:

This conversion can be used for reducing the file size:

Image  (2)

Convert a TIFF image to JPEG:

Convert an animated GIF to an animated PNG:

Tabular  (2)

CSV and TSV can be reliably converted between the two formats:

Convert CSV to XLSX:

Note that the data is saved in the first sheet of the XLSX file:

Options  (3)

CreateIntermediateDirectories  (1)

By default, missing directories are created:

With CreateIntermediateDirectoriesFalse, missing directories are not created:

OverwriteTarget  (2)

By default, FileConvert overwrites any existing output file:

Use OverwriteTargetFalse to prevent overwriting existing files:

Applications  (1)

Use FileSystemMap to convert an entire directory of a certain file type to a new format:

Only convert files with a certain extension:

Possible Issues  (2)

A file cannot be converted to an incompatible format:

FileConvert cannot create compressed archives:

Use CreateArchive to create compressed archives:

Introduced in 2019
 (12.0)