PDA

View Full Version : Unzip or execute files via ftp


dragonash
05-13-2009, 08:26 AM
Ok, so I am hosting with Globat and I swear this was a mistake.
Everything about them is actually pretty good....except their retard sys admins.

The incorporated a stupid 10meg upload limit (but give you unlimited server space... ooooookay). So in order to upload large files, you need to split them.

Zip, RAR, tar.gz.

Everytime I use one of those options, there is always a problem because they are no doubt, retarded. They told me to use those and then they said they dont support it....even though they have unzipped them in the past!

One thing seems to be solid though, they always say to use tar.gz. I have 7zip, but i only get the option of .tar or .gz. Never together. I dont quite understand anyway and their admins cant seem to explain either.

So I am looking for a script to run that will allow me to unzip everything myself. I heard there might be some php scripts i could run to do this. Can anyone help?

Dr. Death
05-13-2009, 04:40 PM
.tar stands for "tape archive" and it's a UNIX format that was used ages ago for backing up data on tape drives. It appears to put multiple files into a single "archive" file for easy storage. However this format is not compressed.

The .gz format is "GNU ZIP" and is the open source version of a zip file (which is actually not "open" or "free" btw.)

Typically what happens is the files and directories are "tarred" to combine them into one archive, then "zipped" to compress the archive.

Extraction is in reverse order: first you unzip the archive, then "untar" it to extract the files and directories from the archive.

Your clue as to the order is in the file extensions: "myarchive.tar.gz" means that the last operation done to the file was to zip it, hence the .gz at the end. When you unzip it, you wind up with the uncompressed archive file, "myarchive.tar".

Saboteur
05-13-2009, 04:55 PM
Just to be (slightly) clearer:

Gzip (GNU zip) is a single-file compression program that utilizes the ZIP (PKZIP) compression algorithm to shrink a single file. Typically, the program appends a ".gz" suffix on the file to indicate that it is a gzip-compressed file. However, gzip does not create multi-file archives like PKZIP, WinZip, etc. (There are *NIX versions of zip/unzip that do exactly what those programs do and are cross-compatible with them. Google "info-zip" for more information on those).

There are other single-file compression progs that are in common use. Bzip2 is very common, and appends a ".bz2" suffix on the files it has compressed. Its slightly less popular than gzip, even though it can often provide 10-20% better compression.

(Side note - the GNU tar program can accommodate gzipped and bzipped files natively without needing a separate compression program.)

Its also not uncommon to have a tarred-and-gzipped file have just a ".tgz" extension instead of ".tar.gz". If you can find a program that can handle that, you may be able to do it all in one step.

Otherwise the rest of DD's explanation is good.

dragonash
05-13-2009, 05:23 PM
that is a very helpful explanation!
thanks guys!

I also found a few php scripts.. but i cant get them to work

<?php
$path = '/httpdocs/test';
$file = '/httpdocs/test/zipfile.gz';

$path_parts = pathinfo($file);
$ext = $path_parts[extension];

if($ext == 'gz')
{
$execute = "gunzip -".$path." $file";
`$execute`;
}
if($ext == 'zip')
{
$execute = "unzip -u $file -d $path";
`$execute`;
}


?>

maybe i didnt put it together correctly, or maybe i just dont have the correct permissions