Server Fault is a question and answer site for system and network administrators. 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 would expect the following command to extract the contents of the top directory in the zip file to the destination directory:

unzip topdir/\* -d destdir

However, what I get is destdir/topdir. What I am looking for is an unzip command similar to

cp -r topdir/* destdir

How do I extract the contents without the topdir path?

share|improve this question

Try the -j option. From the man page:

-j junk paths. The archive's directory structure is not recreated; all files are deposited in the extraction directory (by default, the current one).

share|improve this answer
Thanks for the input. However, as I want to retain the subdirectories of topdir the -j option will not work. – August Karlstrom Dec 1 '11 at 20:16

Your Answer


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.