# extract

Some files can contain embedded subfiles, including archive formats such as `zip` and `rar`, email containers, and Office formats. This sample program makes use of the subfile extraction API methods.

The sample program takes two positional arguments:

- a path to a file
- a path to an output directory

The program copies all the subfiles in the file to the output directory, and prints any errors encountered during extraction. For example, the following output is produced when you run the program on a password-protected 7zip file:

    $ ./extract pass.7z outputdir/
    Error extracting subfile 0
    Name: hello.txt
    Keyview error: The file is password protected

If you provide the correct password using the optional argument, KeyView can extract the file:

    $ ./extract --password 'pass' pass.7z outputdir/
    $ ls outputdir/
    hello.txt

NOTE: In this instance KeyView captures the name of the subfile even without providing a password. Whether this is possible depends on the file format and the encryption options that were used to create the file.

_FT_HTML5_bannerTitle.htm