Solved

Problems using zip

Posted on 2004-03-29
4
209 Views
Last Modified: 2010-04-20
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
0
Comment
Question by:happydog234
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2
4 Comments
 

Author Comment

by:happydog234
ID: 10705813
To clarify, I'm not getting the content of those folders before the ziproot, but I'm getting the simplest dir strucuture,
0
 
LVL 44

Expert Comment

by:Karl Heinz Kremer
ID: 10706788
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
0
 
LVL 44

Accepted Solution

by:
Karl Heinz Kremer earned 500 total points
ID: 10706911
Actually, make this
zip -r myfile.zip .
or
zip -r myfile.zip *

If your want all directories below ziphere, you need to specify the -r switch.

After reading the manpage, it does not look like you can ingore part of the path (you can however junk the directory information completey with the -j flag), so doing the cd is your only option.
0
 

Author Comment

by:happydog234
ID: 10707432
Many thanks- it worked!

[Hangs head in shame].  I can't believe I didn't think of changing the directory...
0

Featured Post

NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Over the last ten+ years I have seen Linux configuration tools come and go. In the early days there was the tried-and-true, all-powerful linuxconf that many thought would remain the one and only Linux configuration tool until the end of times. Well,…
If you have a server on collocation with the super-fast CPU, that doesn't mean that you get it running at full power. Here is a preamble. When doing inventory of Linux servers, that I'm administering, I've found that some of them are running on l…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.
Suggested Courses

736 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question