Zip the contents of a folder without including the folder itself

command linezip

I have a directory called folder that looks like this:

folder
      -> root_folder
                    -> some files

I want to zip this directory into zipped_dir, I tried:

zip -r zipped_dir.zip folder/*

But this generates a ZIP that looks like this:

zipped_dir
          -> folder
                   -> root_folder
                                 -> some files

in other words, it's including the directory whose contents I want to zip. How can I exclude this parent directory from the ZIP, without moving anything?

IE I would like this end result:

zipped_dir
          -> root_folder
                        -> some files

Best Answer

Try to use this command (you will get the idea)

cd folder; zip -r ../zipped_dir.zip *

Maybe there is other way, but this is fastest and simplest for me :)

Related Question