...

View Full Version : Unzipping files on the server



NancyJ
01-02-2006, 09:52 AM
Hi, I have a problem, I will soon be recieving some very large csv files that will be zipped - VERY large, they need to be unzipped on the server and processed, ie I will upload them then the processing script will need to unzip, open and put the data into the database and I dont know where to start. I'm not looking for a complete script, as I said, I havent even seen the files yet, I just know that they will be too big to download and open manually (thats all I have been told)
Just looking for some pointers really.

GJay
01-02-2006, 10:06 AM
http://uk.php.net/zip might be a good place to start, if you have it installed/can install it.
Otherwise, exec() with 'unzip' could be an option?
Or, you could write a bash script that unzips the files at a certain time each day (before the PHP script) runs.

NancyJ
01-02-2006, 01:19 PM
looks like this might do thee trick:

<?

function unzip($zip_file, $src_dir, $extract_dir)
{
copy($src_dir . "/" . $zip_file, $extract_dir . "/" . $zip_file);
chdir($extract_dir);
shell_exec("unzip $zip_file");
}

?>



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum