2

I have a bash script which I use to zip everything in a folder called "distribution" which contains "file1" and "file2":

zip -r archive.zip distribution/*

However, when I open the zip file I see the entire "distribution" folder has been zipped. I just want to zip the files within the distribution folder and not the entire folder itself. How do I do this?

Mark
  • 4,428
  • 14
  • 60
  • 116
  • SO is for programming questions, not general technical support questions. – Barmar Mar 12 '15 at 08:31
  • 1
    There is the answer here [how-to-create-a-zip-file-without-entire-directory-structure][1] [1]: http://stackoverflow.com/questions/9710482/how-to-create-a-zip-file-without-entire-directory-structure – Turrican Mar 12 '15 at 08:42

1 Answers1

3

You can go into the folder first:

cd distribution
zip -r ../archive.zip *

However, this means that when someone unzips it, the files will be put into their current folder, it won't put them into a subfolder.

Barmar
  • 741,623
  • 53
  • 500
  • 612