Home > OS >  Jenkins | UNIX | ZIP
Jenkins | UNIX | ZIP

Time:09-18

zip -r social.zip Google/Facebook/Instagram/*

I'm using the above command in Jenkins script to create a ZIP. But I don't want the same directiory structure in ZIP. I need all the directories & files under Google/Facebook/Instagram/* directly in ZIP.

CodePudding user response:

You can make Google/Facebook/Instagram your current directory by doing a cd or pushd then return to your original directory.

(cd Google/Facebook/Instagram ; zip -r ../../../social.zip *)

or

pushd Google/Facebook/Instagram ; zip -r ../../../social.zip * ; popd

CodePudding user response:

Read the manual; zip -j -r ... or zip --junk-paths -r ...

It even says:

You may want to make a zip archive that contains the files in foo, without recording the directory name, foo. You can use the -j option to leave off the paths, as in:

zip -j foo foo/*

  • Related