# Extract Subfiles

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

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

You can iterate over subfile information using the `subfiles` method. Each element returned by the iterator contains information about the subfile, and a method to let you extract it:

    auto myinput = keyview::io::InputFile{ std::string("InputFile.zip") };
    for (const auto&amp; subfile : KV.subfiles(myinput))
    {
    auto subfile_path = subfile.rawname();
    auto myoutput = keyview::io::OutputFile{ subfile_path };
    subfile.extract(myoutput);
    }

NOTE: This very simple example does not account for folders within container files. For a more complete example, see the extract sample program.

NOTE: The subfiles method returns an instance of the `keyview::Container class`, defined in `Keyview_Container.hpp`. This provides access to information about the container, and access to each subfile. The container maintains a reference to the input file, and so cannot be used after the input file has been destroyed.

© Copyright 2016-2019 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