sunzip icon indicating copy to clipboard operation
sunzip copied to clipboard

Add -l list option to only list filenames

Open stain opened this issue 6 years ago • 3 comments

The sunzip -l option is equivalent to -t -q -q, but instead of testing decompression will only print the file and directory names as they are encountered in the stream.

Note that file names from the local file headers are less reliable than the end-of-file TOC that would otherwise be used, and may include duplicates, deleted and encrypted files.

Output is silent so that STDOUT can be used with grep etc. Filenames are expressed as they will be written for the local OS (discuss!)

Here is example usage on a 1.9 GB zip file:

curl -sS -L 'https://zenodo.org/record/2838898/files/rnaseqwf_0.5.0_mac.zip?download=1' |  sunzip -l

stain avatar Aug 13 '19 00:08 stain

I realized deferred lengths do not work well without decompressing (it can't skip ahead without knowing uncompressed size).

For now e5b5488 -l bails out early with a more useful error message suggesting -t (not ideal as -t has different output format)

Here is an example of deferred length.

stain avatar Sep 03 '19 10:09 stain

I'm curious as to why you opted to use file names from the local file headers, since as you commented these are less reliable than the end-of-file TOC?

woolfie avatar Apr 06 '20 20:04 woolfie

(sorry for missing your comment, @woolfie!)

This was to get filenames listed on STDOUT as soon as the zip is streaming, rather than wait for the end TOC - however of course you still need to wait for the end to get the complete list. If you are only interested in say the first 100 files (get an excerpt list of content for en duser) then you can can Ctrl-C early.

stain avatar Sep 16 '20 11:09 stain