Skip to main content
Version: Fegg 5.x

File::copyAll

Copy all the files in a directory to another directory

Description​

public bool File::copyAll( string $fromDirectory, string $toDirectory )

Copies every file directly under $fromDirectory to $toDirectory with File::copyFile (permission 0644). Subdirectories and symbolic links are not copied, use File::copyDirectory for subdirectories.

Returns false when one of the directories does not exist or a file could not be copied.

Arguments​

NameData typeDefaultRemarks
$fromDirectorystringSource directory
$toDirectorystringDestination directory (must exist)

Example​

Controller
use Fegg\Tool\File;

$file = new File();
$file->copyAll('path/to/foo', 'path/to/bar');