Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add -l list option to only list filenames #3

Open
wants to merge 2 commits into
base: develop
Choose a base branch
from

Conversation

stain
Copy link

@stain stain commented Aug 13, 2019

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

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.
@stain stain changed the base branch from master to develop August 13, 2019 00:28
@stain
Copy link
Author

stain commented Sep 3, 2019

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.

@woolfie
Copy link

woolfie commented Apr 6, 2020

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?

@stain
Copy link
Author

stain commented Sep 16, 2020

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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants