Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

unzip options -t and -l lists entire zip, even sub directories. Is there an option of unzip to read contents just 1 level ? It should list immediate contents of zip. It should not list contents of subdirectories.

I have read this question and its not a duplicate of it.

share|improve this question
why negative vote ? – spa Sep 30 '13 at 16:49

According to the manpage:

[-x xfile(s)]
   An  optional  list of archive members to be excluded from process‐
   ing.  Since wildcard characters  normally  match  (`/')  directory
   separators  (for exceptions see the option -W), this option may be
   used to exclude any files that are in subdirectories.   For  exam‐
   ple,  ``unzip foo *.[ch] -x */*'' would extract all C source files
   in the main directory, but none in  any  subdirectories.   Without
   the  -x  option,  all C source files in all directories within the
   zipfile would be extracted.

So the answer is:

unzip -l <zipfile> -x '*/*'
share|improve this answer

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .