-2

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.

soap
  • 111

1 Answers1

0

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 '*/*'
beroe
  • 1,255