use Illuminate\Filesystem\Filesystem; $filesystem = new Filesystem(); $source = '/path/to/source/directory'; $destination = '/path/to/destination/directory'; $filesystem->copyDirectory($source, $destination);
use Illuminate\Filesystem\Filesystem; $filesystem = new Filesystem(); $source = '/path/to/source/directory'; $destination = '/path/to/destination/directory'; $only = [ '*.jpg', '*.png', ]; $filesystem->copyDirectory($source, $destination, $only);In this example, we're using the optional third argument to specify that only files with a `.jpg` or `.png` extension should be copied to the `destination` directory. Package/Library: Laravel Filesystem Package.