Uploading and downloading files is a chore every webmaster has to cope with on daily basis, but if you do this by compressing the files, uploading the tar or zipped and uncompressing them on server, life becomes a little easier.
Similarly taking backup on a server becomes easier if you just compress the files/folder on server and download the tar.gz file. Usually these commands are run over SSH, but if you do not have SSH access, you can place the commands in php script too.
How to tar/compress folder using php script
if(system("tar -czvf your-fine.tar.gz your-directory/")) echo '<br> <b>Directory compressed successfully!</b>'; else echo '<br> <b>No Donuts for you :(, command has been disabled by host!</b>';
How to untar/uncompress file using php script
Here is how you can easily uncompress your file, just put the following code in php file:
if(system("tar -zxvf your-file.tar.gz")) echo '<br> <b>file uncompressed successfully!</b>'; else echo '<br> <b>No Donuts for you :(, command has been disabled by host!</b>';
I hope that saves some bandwidth and time!