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.

I use this current command that archives the folder "folder-root" and all it's content to a file named "site.zip":

zip -r site.zip 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 stackoverflow.com Mar 17 '13 at 1:26

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

add comment

3 Answers

This should do the job:

zip -rj site.zip 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
add comment

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

zip site.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
add comment
cd folder-root

zip -r ../site.zip *
share|improve this answer
add comment

Your Answer

 
discard

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