Solved

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

Posted on 2007-03-31
4
1,588 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

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…
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

726 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