Solved

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

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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
SSH commands for Nas4free 21 371
Expand a partition in Centos 7 Linux with Virtualmin 1 56
Unix Command -- Challenging  question 7 86
Martian Packets Unix 5 27
This tech tip describes how to install the Solaris Operating System from a tape backup that was created using the Solaris flash archive utility. I have used this procedure on the Solaris 8 and 9 OS, and it shoudl also work well on the Solaris 10 rel…
Introduction Regular patching is part of a system administrator's tasks. However, many patches require that the system be in single-user mode before they can be installed. A cluster patch in particular can take quite a while to apply if the machine…
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…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

947 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now