You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 

36 lines
884 B

<?php
namespace App\Extends;
use App\Models\File;
use Illuminate\Support\Facades\Auth;
use Symfony\Component\HttpFoundation\Response;
class DirCopy {
public static function exec($src, $dst) {
// open the source directory
$dir = opendir($src);
// Make the destination directory if not exist
@mkdir($dst);
// Loop through the files in source directory
while( $file = readdir($dir) ) {
if (( $file != '.' ) && ( $file != '..' )) {
if ( is_dir($src . '/' . $file) )
{
// Recursively calling custom copy function
// for sub directory
self::exec($src . '/' . $file, $dst . '/' . $file);
}
else {
copy($src . '/' . $file, $dst . '/' . $file);
}
}
}
closedir($dir);
}
}