# Extract Subfiles

To filter all files in a container file, the container must be opened and its subfiles extracted to either a file or a stream using the File Extraction API. The extraction process is done repeatedly until all subfiles are extracted and exposed for filtering. Once a subfile is extracted, you can call Filter API methods to filter the data.

If you require a container file, including subfiles, to be filtered to a single file, you must extract all files from the container, filter the files, and then append each filtered output to its parent.

To extract subfiles, follow this general procedure

1. Open the source file by calling the `extOpenDocument` method. This call defines the parameters necessary to open a file for extraction.

2. Determine whether the main file is a container file (contains subfiles) by calling the `extGetMainFileInfo()` method.

3. If the call to `extGetMainFileInfo()` determined the source file is a container file, proceed to Step 4; otherwise, filter the file.

4. Determine whether the subfile is itself a container (contains subfiles) by calling the `extGetSubFileInfo` method.

5. Extract the subfile by calling the `extExtractSubFile` method.

6. If the call to `extGetSubFileInfo` determined the subfile is a container file, repeat Step 1 through Step 5 until all subfiles are extracted and the lowest level of subfiles is reached; otherwise, filter the file.

© Copyright 2016-2020 Micro Focus or one of its affiliates | Send documentation feedback Close Send documentation feedback To open the configured email client on this computer, open an email window. Otherwise, copy the information below to a mail client, and then send this email to swpdl.idoldocsfeedback@microfocus.com. We appreciate your feedback! Product: Topic Title: Help Topic: Feedback:

_FT_HTML5_bannerTitle.htm