Solved

How to .zip a selection of files under unix/linux using zip? with directory structures

Posted on 2007-03-31
4
1,591 Views
Last Modified: 2012-05-05
Hi,

What I want to do is to be able to .zip a set of files (i.e., *.php), but with directory structures.

If I type this:

zip -r * myZipList

it works perfectly fine, and will save the directory structure.

However, if I do this:
zip -r *.php myZipList

It screws up (pissing me off :() and won't save the directory structure, but instead just
saves/stores everything as being in a 'root' directory.

How do I get the zip functionality to ONLY save/store .php files, AND save the directory structure?

If there is a better place to post this as well, please let me know.

Thanks
0
Comment
Question by:cool12399
[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
4 Comments
 
LVL 84

Accepted Solution

by:
ozo earned 500 total points
ID: 18830822
* or *.php will be expanded by the shell before zip ever sees it
You might want
find . -name "*.php" -print | zip  myZipList -@
0
 
LVL 84

Expert Comment

by:ozo
ID: 18830825
or
zip -r myZipList . -i \*.php
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
Installing FreeBSD… FreeBSD is a darling of an operating system. The stability and usability make it a clear choice for servers and desktops (for the cunning). Savvy?  The Ports collection makes available every popular FOSS application and packag…
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.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

691 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