Open Zip files on the command line with support for UTF-8 unicode filenames and 64 bit zip files, with the free Open Source tool Swiss File Knife for Windows, Mac OS X and Linux. doc
sfk unzip in.zip [-pat mask1 !mask2 ...]
extract .zip file contents.
Unicode marked filename support
sfk unzip supports UTF-8 unicode filenames
if they are marked as such, according to the
zip format standard, or if they are provided
as a zip format UTF-8 name extension.
UTF-8 names are listed with 'u' on extraction.
if foreign language names are extracted,
- they may just show ??? for many characters,
because the console cannot print them. just
ignore this and extract it onto an NTFS file
system, then open the output folder in Windows
file explorer, to see the correct names.
- other sfk functions may not be able to read
the extracted files, if they use characters
outside of your windows codepage.
i.e. you may be able to extract chinese files
on a west european windows, but other functions
like sfk find will then fail to read them.
Unicode unmarked filenames
some old non-standard tools under linux/mac
may produce zip files with unmarked UTF-8 names,
which show no 'u' flag on extraction.
to force extraction as UTF-8, use: sfk unzipuniCodepage filename support
filenames which are not marked as 'u' UTF-8,
but contain hicodes like umlauts or accents,
are considered to use codepage 850, the system
codepage of your computer. this can be wrong if
the file was created with a different codepage.
you may then try option -fromcode=n with n like
1252 850 852 866 1250 1251 or any other codepage.
64 bit zip file support
sfk unzip can extract 64 bit zip files with sizes
over 2 gb. sfk xe search in zip file contents is
limited to smaller files, for details: sfk help xe
-pat mask extract only files having mask in their
path or filename. use -pat !mask
to exclude paths or filenames.
-pat \mask\ says the path or file
must start and end with mask.
-test check the archive content integrity
without writing any files.
-verbose list full details for every file while
in simulation. prints raw utf-8 or
codepage filenames from the zip,
allowing output redirect to file.
add -full now for more details.
-todir x write output to folder x
-asdir x rename top level folder name on extract.
fails if there are multiple top folders
in the zip, or files without folders.
-force continue after errors.
-uauto detect UTF-8 filenames just by looking
at their characters. this is not fully
safe, and should be used only to fix
bad names from zip files created with
old non-standard tools.
-noextutf do not use utf extension field,
to see the contained oem names.
-keep keep bad output file even if
crc check failed.
-offtime expect file times which are
one hour off, depending on DST.
for details see: sfk help offtime
-fromcode=n set zip filename codepage manually.
default on this computer is 850.
sfk unzip supports text output chaining.
see alsosfk zip create a zip file
sfk space show free disk space
sfk unzipuni extract all as UTF-8
sfk checkzip test zip integrity
- Depeche View Pro can directly view the content
of .zip, .tar.gz and .tar.bz2 files, for quick
analysis of source packages without extraction.
- SFK XE can search in .zip, .tar.gz and .tar.bz2
archive contents directly like:
sfk xfind -arc in.zip "/foo*bar/"
search in all files within in.zip
sfk xfind -arc mydir "/foo*bar/"
search in all .zip, .tar.gz etc. files
within folder mydir
a demo is contained in this binary (it reads
the first 1000 bytes per archive entry).
- an overview of further zip/unzip tools
for the command line is available under:
stahlworks.com/zipexamplessfk unzip in.zip
extract whole content of in.zip
sfk unzip in.zip -pat mydir .txt
extract only files with mydir and .txt
in their path, no matter in which order.
sfk unzip in.zip -pat "foo*bar"
extract foo1bar, foo2bar but not barfoo.
sfk unzip in.zip -pat \mydir\ !.obj
extract mydir but not mydir2 or oldmydir
and exclude all .obj files.
sfk unzip in.zip -verbose >mylist.txt
write file list with details and raw names
to mylist.txt, allowing to view this in
utf-8 capable editors like Notepad++.
sfk unzip in.zip +filter -!test
extract all from in.zip, but do not print
any names with "test" to terminal.