Skip to content

Commit

Permalink
Fix \Cake\Filesystem\Folder::copy() documentation
Browse files Browse the repository at this point in the history
Fix \Cake\Filesystem\Folder::copy() parameter documentation.
cakephp#7643
  • Loading branch information
TekkCraft authored Jul 6, 2023
1 parent 2092a58 commit bac48eb
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions en/core-libraries/file-folder.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,24 +94,30 @@ Folder API
$dir = new Folder();
$dir->chmod('/path/to/folder', 0755, true, ['skip_me.php']);

.. php:method:: copy(array|string $options = [])
.. php:method:: copy(string $to, array $options = [])
Recursively copy a directory. The only parameter $options can either
be a path into copy to or an array of options::
Recursively copy a directory. The parameter $to is the location to copy to. The $options an array of options::

$folder1 = new Folder('/path/to/folder1');
$folder1->copy('/path/to/folder2');
// Will put folder1 and all its contents into folder2

$folder = new Folder('/path/to/folder');
$folder->copy([
'to' => '/path/to/new/folder',
$folder->copy('/path/to/new/folder', [
'from' => '/path/to/copy/from', // Will cause a cd() to occur
'mode' => 0755,
'skip' => ['skip-me.php', '.git'],
'scheme' => Folder::SKIP // Skip directories/files that already exist.
]);

Available options:

* ``from`` The directory to copy from, this will cause a cd() to occur, changing the results of pwd().
* ``mode`` The mode to copy the files/directories with as integer, e.g. 0775.
* ``skip`` Files/directories to skip.
* ``scheme`` Folder::MERGE, Folder::OVERWRITE, Folder::SKIP
* ``recursive`` Whether to copy recursively or not (default: true - recursive)

There are 3 supported schemes:

* ``Folder::SKIP`` skip copying/moving files & directories that exist in the
Expand Down

0 comments on commit bac48eb

Please sign in to comment.