function mget($filelist) {

        $result = true;

        foreach ($filelist as $remotepath => $localpath) {

            $localpath   = rtrim($localpath, "/");
            $remotepath  = rtrim($remotepath, "/");

            // attempt to create local path
            if ($this->is_dir($remotepath)) {
                $pathparts = explode("/", $localpath."/ "); // add one level, last level will be created as dir
            } else {
                $pathparts = explode("/", $localpath);
            }
            $checkpath = "";
            for ($i=1; $i<sizeof($pathparts)-1; $i++) {
                $checkpath .= "/" . $pathparts[$i];
                if (!is_dir($checkpath)) {

                    $result &= mkdir($checkpath);
                }
            }

            if ($result) {
                // recurse directories
                if ($this->is_dir($remotepath)) {
                    $list = $this->ls($remotepath);

                    $fl = array();
                    foreach($list as $e) {
                        $fullpath = urldecode($e['href']);
                        $filename = basename($fullpath);
                        if ($filename != '' and $fullpath != $remotepath . '/') {
                            $fl[$remotepath."/".$filename] = $localpath."/".$filename;
                        }
                    }
                    $result &= $this->mget($fl);
                } else {
                    $result &= ($this->get_file($remotepath, $localpath));
                }
            }
        }
        return $result;
    }
function mget($filelist) {

        $result = true;

        foreach ($filelist as $remotepath => $localpath) {

            $localpath   = rtrim($localpath, "/");
            $remotepath  = rtrim($remotepath, "/");

            // attempt to create local path
            if ($this->is_dir($remotepath)) {
                $pathparts = explode("/", $localpath."/ "); // add one level, last level will be created as dir
            } else {
                $pathparts = explode("/", $localpath);
            }
            $checkpath = "";
            for ($i=1; $i<sizeof($pathparts)-1; $i++) {
                $checkpath .= "/" . $pathparts[$i];
                if (!is_dir($checkpath)) {

                    $result &= mkdir($checkpath);
                }
            }

            if ($result) {
                // recurse directories
                if ($this->is_dir($remotepath)) {
                    $list = $this->ls($remotepath);

                    $fl = array();
                    foreach($list as $e) {
                        $fullpath = urldecode($e['href']);
                        $filename = basename($fullpath);
                        if ($filename != '' and $fullpath != $remotepath . '/') {
                            $fl[$remotepath."/".$filename] = $localpath."/".$filename;
                        }
                    }
                    $result &= $this->mget($fl);
                } else {
                    $result &= ($this->get_file($remotepath, $localpath));
                }
            }
        }
        return $result;
    }
function mget ( $ filelist ) { $ result = true ; foreach ( $ filelist as $ remotepath => $ localpath ) { $ localpath = rtrim ( $ localpath , "/" ) ; $ remotepath = rtrim ( $ remotepath , "/" ) ; // attempt to create local path if ( $ this -> is_dir ( $ remotepath ) ) { $ pathparts = explode ( "/" , $ localpath . "/ " ) ; // add one level, last level will be created as dir } else { $ pathparts = explode ( "/" , $ localpath ) ; } $ checkpath = "" ; for ( $ i = 1 ; $ i < sizeof ( $ pathparts ) - 1 ; $ i ++ ) { $ checkpath .= "/" . $ pathparts [ $ i ] ; if ( ! is_dir ( $ checkpath ) ) { $ result &= mkdir ( $ checkpath ) ; } } if ( $ result ) { // recurse directories if ( $ this -> is_dir ( $ remotepath ) ) { $ list = $ this -> ls ( $ remotepath ) ; $ fl = array ( ) ; foreach ( $ list as $ e ) { $ fullpath = urldecode ( $ e [ 'href' ] ) ; $ filename = basename ( $ fullpath ) ; if ( $ filename != '' and $ fullpath != $ remotepath . '/' ) { $ fl [ $ remotepath . "/" . $ filename ] = $ localpath . "/" . $ filename ; } } $ result &= $ this -> mget ( $ fl ) ; } else { $ result &= ( $ this -> get_file ( $ remotepath , $ localpath ) ) ; } } } return $ result ; }
Public method mget

Gets multiple files and directories.

FileList must be in format array("remotepath" => "localpath").
Filenames are UTF-8 encoded.

@param array filelist
@return bool true on succes, other int status code on error
Public method mget