# 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.

© 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