# Extract Metadata from Files

The `ExtractMetadata` task extracts metadata from the file associated with a document. This task extracts a subset of the metadata obtained by standard KeyView filtering. It is faster than standard KeyView filtering and does not extract the file content.

TIP: When documents are ingested, CFS automatically extracts metadata. Do not use this task unless you have set the fields `AUTN_NO_FILTER` and `AUTN_NO_EXTRACT` on a document and want to extract basic metadata only.

The `ExtractMetadata` task is configured as a Pre task. Specify the name of the section that contains settings for the task. For example:

    [ExtractMetadata]
    Pre0=Lua:scripts/nofilter.lua
    Pre1=ExtractMetadata:ExtractMetadataSettings

    [ExtractMetadataSettings]
    FieldnamePrefix=FIELD_
    ReservedFieldnames=Reserved1,Reserved2

The `Pre0` task runs a Lua script that adds the fields `AUTN_NO_FILTER` and `AUTN_NO_EXTRACT` to documents. Adding these fields prevents KeyView from filtering the documents and extracting subfiles.

The `Pre1` task runs the `ExtractMetadata` task using the settings contained in the `[ExtractMetadataSettings]` section of the CFS configuration file.

The `FieldnamePrefix` parameter specifies a prefix for the names of the metadata fields that are added to the document. The `ReservedFieldnames` parameter specifies a comma-separated list of field names that the task must not use. If the task needs to add a metadata field with one of the specified names, it prefixes the name with an underscore. For example, with the settings specified above, the task would not add a field named `FIELD_Reserved1`. Instead, the task would add `_FIELD_Reserved1`.

_FT_HTML5_bannerTitle.htm