$joomlaPath = '/path/to/joomla'; $joomlaFolder = 'images'; $sourceFolder = $joomlaPath.DIRECTORY_SEPARATOR.$joomlaFolder; $destinationFolder = '/path/to/destination/folder'; JFolder::copy($sourceFolder, $destinationFolder);
$joomlaPath = '/path/to/joomla'; $joomlaFolder = 'media'; $sourceFolder = $joomlaPath.DIRECTORY_SEPARATOR.$joomlaFolder; $destinationFolder = '/path/to/destination/folder'; $filter = array('*.jpg', '*.png'); JFolder::copy($sourceFolder, $destinationFolder, $filter);This example copies the 'media' folder and only includes JPEG and PNG files in the destination folder. All other files are excluded. Package library: Joomla Framework (Joomla\CMS\Filesystem\Folder)