kirby/vendor/getkirby/toolkit/lib/folder.php
/**
   * Copies the directory to a new location
   * 
   * @param string $to
   * @return boolean
   */
Copies the directory to a new location

@param string $to
@return boolean
Copies the directory to a new location @param string $to @return boolean
public function copy($to) {
    $copy = new static($to);
    if(!$copy->make()) return false;
    foreach($this->content() as $item) {
      if(is_a($item, 'Folder')) {
        $dest = $to . DS . $item->name();
      } else {
        $dest = $to . DS . $item->filename();
      }
      if(!$item->copy($dest)) return false;
    }
    return $copy;
  }
public function copy ( $ to ) { $ copy = new static ( $ to ) ; if ( ! $ copy -> make ( ) ) return false ; foreach ( $ this -> content ( ) as $ item ) { if ( is_a ( $ item , 'Folder' ) ) { $ dest = $ to . DS . $ item -> name ( ) ; } else { $ dest = $ to . DS . $ item -> filename ( ) ; } if ( ! $ item -> copy ( $ dest ) ) return false ; } return $ copy ; }
Copies the directory to a new location
Copies the directory to a new location
// Make destination directory // Loop through all subfiles and folders