PHP Zip Question

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
Jason Curran
Forum Newbie
Posts: 1
Joined: Mon Jun 08, 2009 2:19 pm

PHP Zip Question

Post by Jason Curran »

I'm trying to zip up the folder "website" as seen in the code below.

But when I open the Zip file, the files I am trying to Zip are 5 directories deep in the zip file. Does anyone know a way to have the zip file contain only the actual directory and not all of the directories in the path ?

Code: Select all

 
<?php
 
if (system('zip -r /home/path/to/my/website/newzipfile.zip 
                   /home/path/to/my/website')) {
                           
    echo '<p>It worked!</p>';
} else {
    echo '<p>It did NOT work!</p>';
} 
 
?>
Last edited by Benjamin on Mon Jun 08, 2009 2:23 pm, edited 1 time in total.
Reason: Changed code type from text to php.
Post Reply