use Illuminate\Filesystem\Filesystem; $filesystem = new Filesystem(); $directoryPath = '/path/to/new/directory'; if(!$filesystem->exists($directoryPath)) { $filesystem->makeDirectory($directoryPath, 0755, true); }
use Illuminate\Filesystem\Filesystem; $filesystem = new Filesystem(); $directoryPath = '/path/to/delete'; if($filesystem->exists($directoryPath)) { $filesystem->deleteDirectory($directoryPath); }
use Illuminate\Filesystem\Filesystem; $filesystem = new Filesystem(); $sourceDir = '/path/to/source/dir'; $destinationDir = '/path/to/destination/dir'; if($filesystem->isDirectory($sourceDir)) { $filesystem->copyDirectory($sourceDir, $destinationDir); }
use Illuminate\Filesystem\Filesystem; $filesystem = new Filesystem(); $sourceDir = '/path/to/source/dir'; $destinationDir = '/path/to/destination/dir'; if($filesystem->isDirectory($sourceDir)) { $filesystem->moveDirectory($sourceDir, $destinationDir); }Package Name: The package library used for these examples is "illuminate/filesystem".