4

I'm using zip program in a bash script and i would like to create an archive containing all files in a folder without adding the folder itself to the archive.

I have such files :

script.sh
files/
files/1
files/2

I'm using this command in script.sh

zip -q -9 -r arch.zip files/*

but this creates a files folder in the archive and i would like to get files 1 and 2 directly at the root of the archive.

How can i modify the parameters passed to zip command to prevent it from adding files in this archive ?

Thanks

FIXED :

Here and Here

Obviously, SO search engine is more efficient when the question is posted than before ...

Community
  • 1
  • 1
ibi0tux
  • 2,481
  • 4
  • 28
  • 49
  • 1
    Once the question has been posted, you had already reflected on what your needs are exactly, then asking the machine (search engine) becomes straight-forward. – Meetai.com Mar 03 '15 at 08:58

2 Answers2

4
cd files
zip -q -9 -r ../arch.zip *
Ansgar Wiechers
  • 193,178
  • 25
  • 254
  • 328
3

you should use -j key. Try this way:

zip -q -9 -j arch.zip files/*