...

View Full Version : Compress a directory and all its multilevel subdirectories using php, tar and gz



xeirus
11-20-2011, 10:18 PM
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.

Adee
11-20-2011, 11:04 PM
why cant you just use tar cvfz filename.tar.gz /directory

xeirus
11-20-2011, 11:07 PM
I'm trying this now:

exec('tar cvfz mytarfile.tgz /home/public/images/');

But nothing happens.

Any idea?

Adee
11-20-2011, 11:12 PM
I'm trying this now:

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.

xeirus
11-20-2011, 11:14 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum