Пример #1
0
 /**
  * Download $remote_path directory recursive as $local_path.
  * 
  * @throws
  * @param string $remote_path
  * @param string $local_path
  * @return vector<string>
  */
 public function getDir($remote_path, $local_path)
 {
     $entries = $this->ls($remote_path);
     Dir::create($local_path, 0, true);
     foreach ($entries as $path => $info) {
         if ($info['type'] === 'f') {
             $this->get($path, $local_path . '/' . $info['name']);
         } else {
             if ($info['type'] === 'l') {
                 if (FSEntry::isLink($local_path . '/' . $info['name'], false)) {
                     File::remove($local_path . '/' . $info['name']);
                 }
                 print "link: " . $info['link'] . " - " . $local_path . '/' . $info['name'] . "\n";
                 FSEntry::link($info['link'], $local_path . '/' . $info['name'], false);
             } else {
                 if ($info['type'] === 'd') {
                     $this->getDir($path, $local_path . '/' . $info['name']);
                 }
             }
         }
     }
 }