Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 use this current command that archives the folder "folder-root" and all it's content to a file named "":

zip -r folder-root/*

Problem is - I want to zip the contents of the folder and not the folder itself. Notice: I must issue the command from the current directory (ie - can't issue it from inside the folder).

How do I do that?

share|improve this question

migrated from Mar 17 '13 at 1:26

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

This should do the job:

zip -rj folder-root/*

zip --help says:

-j   junk (don't record) directory
share|improve this answer
This will junk any subdirectory inside the directory as well. Not sure if that was wanted. – henko Oct 7 '13 at 8:54
cd folder-root

zip -r ../ *
share|improve this answer

This question has a similiar problem and the answer could work. How can I build a tar from stdin?

zip `ls -1 folder-root/`

This will create the list of files that you want to add into your zip file.

share|improve this answer
Unless the files have spaces – jordanm Mar 16 '13 at 19:58

Your Answer


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