Avatar of happydog234
happydog234 asked on

Problems using zip

I'm trying to zip a directory into a zip file (and all sub dirs and files in the that dir)

I can get it to zip fine, but it stores the directory structure BEFORE the root location of the zip.

Example:
zip myfile.zip E:\www\mydir\ziphere

It zips from the E:, not from the ziphere, so when I extract the file I get the root folders... www then mydir then finally ziphere... that doens't work for my needs (moving zip file one machin to the next) how do I suporess the storing of this early dir structure *but maintain the strucutre beyond my root)?

thanks
Linux

Avatar of undefined
Last Comment
happydog234

8/22/2022 - Mon
ASKER
happydog234

To clarify, I'm not getting the content of those folders before the ziproot, but I'm getting the simplest dir strucuture,
Karl Heinz Kremer

I have not used zip in a while, so I first have to check if there is a command line option to allow this. One option that will definitely work is to first cd to the "ziphere" directory and use something like this:

cd E:\www\mydir\ziphere
zip myfile.zip .

Or, if you want ziphere to be the first element:
cd e:\www\mydir
zip myfile.zip ziphere
ASKER CERTIFIED SOLUTION
Karl Heinz Kremer

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
ASKER
happydog234

Many thanks- it worked!

[Hangs head in shame].  I can't believe I didn't think of changing the directory...
I started with Experts Exchange in 2004 and it's been a mainstay of my professional computing life since. It helped me launch a career as a programmer / Oracle data analyst
William Peck