Hi,
I'm currently using this PHP code to extract .zip files
<?php
exec('unzip some_datafeed.zip',$ret)
?>
This works for one file at a time. Anyone know how I can make this do multiple files like:
<?php
exec('unzip some_datafeed.zip',$ret)
exec('unzip some_datafeed1.zip',$ret)
exec('unzip some_datafeed2.zip',$ret)
?>
By the way, if the .zip files are small enough, the above will work. As the files get larger I have to do one at a time. Maybe its an execution time issue?
Hi
Saw this node with interest, however I'm not too clever in sorting what goes where!
Can anyone advise where I place the
<?php
exec('unzip some_datafeed.zip',$ret)
?>
That is mentioned above!
Thanks
Hi delboy,
These commands would have been part of a PHP version of an automation system, as PHP can (if suitably configured) execute system commands / programs like wget, unzip etc.
Ideally, most flexibility comes from setting up an automation system using a shell script, which can contain lines to fetch, uncompress / rename etc. and then import - lots of details in the following thread:
http://www.pricetapestry.com/node/198
If setting up automation is what you're looking to do, start with the above thread; but if you don't have the facilities to set-up such a system on your server / hosting account then info for setting up a PHP automation script (to which the above would be relevant) can be found here...
Cheers,
David.
Hi,
As you're shelling out to a system command, wildcards should apply, so you could use:
<?php
exec('unzip *.zip',$ret)
?>
However if you want the greater control and think it may be a timeout issue; try adding the following line at the top of your script:
set_time_limit(0);
Hope this helps!
Cheers,
David.