public function sendRecursive($local_path, $remote_path, $overwrite = false)
    {
        if (false === is_dir($local_path)) {
            return $this->send($local_path, $remote_path, $overwrite);
        }

        if (false === $lls = @scandir($local_path)) {
            return $this->_trigger_error(sprintf('Unable to list files of local directory %s.', $local_path));
        }

        $remote_path = $this->_getAbsoluteRemotePath($remote_path);
        if (true === file_exists($remote_path)
                && false === is_dir($remote_path)) {
            return $this->_trigger_error(sprintf('A file named %s already exists, can\'t create folder.', $remote_path));
        } elseif (false === file_exists($remote_path)
                && false === $this->mkdir($remote_path, true)) {
            return false;
        }

        $currentpwd = $this->pwd();
        $this->cd($remote_path);
        foreach ($lls as $file) {
            if ($file != "." && $file != "..") {
                $this->sendRecursive($local_path.DIRECTORY_SEPARATOR.$file, $file, $overwrite);
            }
        }
        $this->cd($currentpwd);

        return true;
    }
public function sendRecursive($local_path, $remote_path, $overwrite = false)
    {
        if (false === is_dir($local_path)) {
            return $this->send($local_path, $remote_path, $overwrite);
        }

        if (false === $lls = @scandir($local_path)) {
            return $this->_trigger_error(sprintf('Unable to list files of local directory %s.', $local_path));
        }

        $remote_path = $this->_getAbsoluteRemotePath($remote_path);
        if (true === file_exists($remote_path)
                && false === is_dir($remote_path)) {
            return $this->_trigger_error(sprintf('A file named %s already exists, can\'t create folder.', $remote_path));
        } elseif (false === file_exists($remote_path)
                && false === $this->mkdir($remote_path, true)) {
            return false;
        }

        $currentpwd = $this->pwd();
        $this->cd($remote_path);
        foreach ($lls as $file) {
            if ($file != "." && $file != "..") {
                $this->sendRecursive($local_path.DIRECTORY_SEPARATOR.$file, $file, $overwrite);
            }
        }
        $this->cd($currentpwd);

        return true;
    }
public function sendRecursive ( $ local_path , $ remote_path , $ overwrite = false ) { if ( false === is_dir ( $ local_path ) ) { return $ this -> send ( $ local_path , $ remote_path , $ overwrite ) ; } if ( false === $ lls = @ scandir ( $ local_path ) ) { return $ this -> _trigger_error ( sprintf ( 'Unable to list files of local directory %s.' , $ local_path ) ) ; } $ remote_path = $ this -> _getAbsoluteRemotePath ( $ remote_path ) ; if ( true === file_exists ( $ remote_path ) && false === is_dir ( $ remote_path ) ) { return $ this -> _trigger_error ( sprintf ( 'A file named %s already exists, can\'t create folder.' , $ remote_path ) ) ; } elseif ( false === file_exists ( $ remote_path ) && false === $ this -> mkdir ( $ remote_path , true ) ) { return false ; } $ currentpwd = $ this -> pwd ( ) ; $ this -> cd ( $ remote_path ) ; foreach ( $ lls as $ file ) { if ( $ file != "." && $ file != ".." ) { $ this -> sendRecursive ( $ local_path . DIRECTORY_SEPARATOR . $ file , $ file , $ overwrite ) ; } } $ this -> cd ( $ currentpwd ) ; return true ; }
Copy recursively a local file and subfiles to the remote server.

@param string  $local_file
@param string  $remote_file
@param boolean $overwrite

@return boolean Returns TRUE on success or FALSE on error
Copy recursively a local file and subfiles to the remote server .