note 101858 deleted from rarentry.extract by danbrown
| From: | danbrown@php.net | Date: | Fri, 14 Jan 2011 17:36:44 +0000 |
| Subject: | note 101858 deleted from rarentry.extract by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-175754@lists.php.net to get a copy of this message | ||
Note Submitter: TorcK
----
How to extract all files from archive to selected dir
/**
* Extract archive $filename to $filepath
*
* @return bool
*/
function extract($filename, $filepath)
{
$res = true;
$rar_file = rar_open($filename);
if ($rar_file) {
$list = rar_list($rar_file);
foreach($list as $file) {
$file->extract($filepath);
}
rar_close($rar_file);
$res = true;
} else {
$res = false;
}
return $res;
}