Solved

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

Posted on 2007-03-31
4
1,573 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
Comment Utility
* 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
Comment Utility
or
zip -r myZipList . -i \*.php
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
forget admin password 8 22
llcommand 6 75
Sed question 2 45
unix solaris snoop command 6 42
Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
Why Shell Scripting? Shell scripting is a powerful method of accessing UNIX systems and it is very flexible. Shell scripts are required when we want to execute a sequence of commands in Unix flavored operating systems. “Shell” is the command line i…
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.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

763 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

7 Experts available now in Live!

Get 1:1 Help Now