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

I have multiple zip files inside a directory. In which I want the list of files inside each zip file. I dot want to extract them in the folder.

presently I am able to extract them, after that only I can get the file names. But I don't want to extract the zip files as there is space constraint on the system. Please advice.

share|improve this question

migrated from stackoverflow.com Nov 1 '12 at 12:26

This question came from our site for professional and enthusiast programmers.

    
What language are you using? Are you just want to command this in SSH? – TheBlackBenzKid Oct 31 '12 at 11:26
    
yes in ssh only – shekhar Oct 31 '12 at 18:00
up vote 2 down vote accepted

Since you have multiple files, then in order to unzip -l all of them, you need to pass a quoted wildcard to the unzip tool, or else the shell will expand the wildcard and unzip will receive multiple filenames. So you need to:

unzip -l "*.zip"

The "*.zip" part makes sure that unzip actually receives the * character intact.

share|improve this answer
    
Thanks it worked!! now what if i want to use logsave to save the output of this listing to any log file. – shekhar Oct 31 '12 at 11:27
    
You simply redirect the output: unzip -l "*.zip" >> logfile.log This will append the output to logfile.log. If instead you want to overwrite rather than append, use > instead of >>. – Nikos C. Oct 31 '12 at 11:30
unzip -l {myzipfile}

will just report the contents (filenames)

share|improve this answer
    
thanks For the prompt reply but i am not able to get any result :( – shekhar Oct 31 '12 at 11:18

You must log in to answer this question.

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