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
chroot
. – loretoparisi Aug 25 '16 at 14:24zip -r zipped_dir.zip folder/*
– Tobias Kolb Sep 12 '18 at 09:35pushd
instead ofcd
so you can come back to the same location with apopd
. – Pablo D. Feb 15 '19 at 18:35cd -
will do the work (only one command) :) Orcd ..
– Romeo Ninov Feb 15 '19 at 18:37zip -r ../zipped_dir.zip .* *
– Taylan Jan 13 '20 at 13:37cd folder/folder; zip -r ../../zipfile.zip *; cd ../../
– luis19mx Sep 08 '20 at 20:46cd folder; zip -ur ../zipped_dir.zip .
– Marnix.hoh Oct 13 '21 at 08:13