7

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?

8

This should do the job:

zip -rj site.zip folder-root/*

zip --help says:

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

zip -r ../site.zip *
| improve this answer | |
1

This question has a similiar problem and the answer could work. https://stackoverflow.com/questions/2597875/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.

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

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy