Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

1 Answer 1

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

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.