Monday, October 10, 2022

[SOLVED] Jenkins | UNIX | ZIP

Issue

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.


Solution

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



Answered By - brunson
Answer Checked By - Katrina (WPSolving Volunteer)