NAME

file_unpack2 - aggressively unpack archives, based on mime-types

SYNOPSIS

file_unpack2 [options] input.tar.gz ...
file_unpack2 [options] input/ ...
file_unpack2 -l
file_unpack2 -p

# unpack one archive, one level deep, into the current directory
file_unpack2 example.tar.gz

# recursively unpack everything under src/ into /tmp/out
file_unpack2 --deep -D /tmp/out src/

# just report the mime-type, like 'file -i'
file_unpack2 -m mystery.bin

DESCRIPTION

file_unpack2 is the command line front-end for File::Unpack2. It unpacks archive files by dispatching to mime-type specific helpers, and (with --deep) recursively descends into anything it unpacks that looks like an archive itself. Its goal is to extract as much readable text as possible from an arbitrary input.

Unpacking is non-recursive (one level) by default, unless the program name contains the substring deep. See "OPTIONS".

OPTIONS

-v --verbose

Be more verbose. Repeatable. Default: 1.

-q --quiet

Be quiet, not verbose.

-A --archive_dirs

Use exact archive names as subdirectories, modified by appending ._* to avoid collisions. Default: use truncated and/or modified archive names. E.g. example.zip is per default unpacked into example/. With -A, it is unpacked into example.zip._/. This does not apply for single file archives; they are always unpacked without a directory.

-C dir
-D --destdir dir

Directory where to place the output file or directory. A subdirectory is created if there is more than one file to unpack. Default: current dir.

-E --exclude glob.pat

Specify files and directories that are not unpacked. Can be given multiple times.

-F --fullpath-log

Always use full path names in the logfile. Default: unpacked path names are written relative to destdir.

--exclude-vcs --no-exclude-vcs --vcs --no-vcs

Group switch for directory glob patterns of most version control systems. This affects at least SCCS, RCS, CVS, .svn, .git, .hg and .osc. The logfile has a {skipped}{exclude} counter. Default: exclude-vcs on.

-1 --one-shot

Make the unpacker non-recursive: perform one level of unpacking only. This is the default unless the name of the program contains the substring deep.

--deep --recursive

Make the unpacker recursive: perform all possible levels of unpacking. This is the default if the name of the program contains the substring deep.

-h --help -?

Print this online help.

-L --logfile file.log

Specify a logfile where freshly unpacked files are reported. When a logfile is specified, its format is JSON; the default is STDOUT with format PLAIN.

-l --list-helpers

Overview of mime-type patterns and their helper commands.

-p --print-helpers

List all builtin mime-helpers and all external mime-helpers as a nested Perl data structure.

-P --params KEY=VALUE

Place additional params into the logfile.

--maxfilesize size

Truncate an unpacked file if it gets larger than the specified size. Size can be given as bytes (plain integer), or with a K, M, G or T suffix for kilo-, mega-, giga- or tera-bytes. Default: 2.6G.

-m --mimetype

Do not unpack, just report the mime-type of the archive. Output format is similar to file -i, unless -q or -v are given. With -v, the unpacker command is also printed.

-R --world-readable

Make the unpacked tree world readable. Default: user readable.

-n --no-op

Do not unpack. Print the first unpack command only.

-u --use-mime-helper-dir dir

Include a directory of external mime helper scripts (named after the mime types they handle). Usable multiple times; later additions take precedence. File::Unpack2 ships no helpers of its own, so this option, or the FILE_UNPACK2_HELPER_DIR environment variable, is how you add a directory of them.

Follow (and unpack) symlinks that point to files (or archives). Used once, we follow only symlinks that are present before unpacking starts. Used twice, we also follow symlinks that were unpacked from an archive. Symlinks to directories or other (dangling) symlinks are always ignored. The logfile has a {skipped}{symlink} counter. Default: skip all symlinks.

-V --version

Print the File::Unpack2 version and exit.

SEE ALSO

File::Unpack2

AUTHOR

Juergen Weigert <jnw@cpan.org>, maintained by Sebastian Riedel <sriedel@suse.com> for use with Cavil.

COPYRIGHT AND LICENSE

Copyright (C) 2010-2014 Juergen Weigert, (C) 2023-2026 Sebastian Riedel.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either the GNU General Public License or the Artistic License.