Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-20-2011, 10:18 PM   PM User | #1
xeirus
New Coder

 
Join Date: Aug 2008
Posts: 66
Thanks: 23
Thanked 0 Times in 0 Posts
xeirus is an unknown quantity at this point
Question Compress a directory and all its multilevel subdirectories using php, tar and gz

Hi!
I need a "very simple" PHP script which can compress a directory and all its multi-(infinite)level sub-directories using with .tar and .gz
I have tried many complex scripts so far which don't work as most of them use ZIP and I don't have access to ZIP
And a few of the simple ones, just don't function.

Please help!

Thank you !

- Xeirus.
xeirus is offline   Reply With Quote
Old 11-20-2011, 11:04 PM   PM User | #2
Adee
Regular Coder

 
Join Date: Jul 2010
Location: Oregon City
Posts: 280
Thanks: 5
Thanked 50 Times in 49 Posts
Adee can only hope to improve
why cant you just use tar cvfz filename.tar.gz /directory
Adee is offline   Reply With Quote
Old 11-20-2011, 11:07 PM   PM User | #3
xeirus
New Coder

 
Join Date: Aug 2008
Posts: 66
Thanks: 23
Thanked 0 Times in 0 Posts
xeirus is an unknown quantity at this point
I'm trying this now:
PHP Code:
exec('tar cvfz mytarfile.tgz /home/public/images/'); 
But nothing happens.

Any idea?
xeirus is offline   Reply With Quote
Old 11-20-2011, 11:12 PM   PM User | #4
Adee
Regular Coder

 
Join Date: Jul 2010
Location: Oregon City
Posts: 280
Thanks: 5
Thanked 50 Times in 49 Posts
Adee can only hope to improve
Quote:
Originally Posted by xeirus View Post
I'm trying this now:
PHP Code:
exec('tar cvfz mytarfile.tgz /home/public/images/'); 
But nothing happens.

Any idea?

do you have access to a command line? i was compressing some folder the other day with like 160mb of images in it an it wasn't working executing it via web browser, but it worked in the command line.
Adee is offline   Reply With Quote
Old 11-20-2011, 11:14 PM   PM User | #5
xeirus
New Coder

 
Join Date: Aug 2008
Posts: 66
Thanks: 23
Thanked 0 Times in 0 Posts
xeirus is an unknown quantity at this point
Yes, but I want the end user to be able to do this, who doesn't have access to a command line.
This will be done through a CMS control panel so that my clients can do their own backups.
xeirus is offline   Reply With Quote
Reply

Bookmarks

Tags
compress, directory, gzip, php, tar

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 03:18 PM.


Advertisement
Log in to turn off these ads.