How copy entire directory from one folder two another using laravel 5
Solution 1
More than one year later :)
Use path helpers functions https://laravel.com/docs/5.6/helpers
\File::copyDirectory( public_path . 'to/the/app', resource_path('to/the/app'));
Solution 2
We can do it in laravel 5.8 using file facade as followings:
use Illuminate\Support\Facades\File;
File::copyDirectory(__DIR__.'/form-directory', resource_path('to-directory'));
Hope, it'll be helpful.
Solution 3
Just do this:
/* Move test images from public folder to storage folder */
$source = "source/path";
$destination = "public/files";
File::copyDirectory(base_path($source), base_path($destination));
Related videos on Youtube
Kiyarash
I'm a composer... I tried music since 8 years old and programming since 18 years old... It's about three years I started to try web programming... That's great... Internet is just like our universe, and we will be creator when we are developing an application. I want to be one of the best in the world and trying to... Stackoverflow is my favorite web site and after this, I like developer.mozilla.com...
Updated on June 23, 2022Comments
-
Kiyarash almost 2 years
May be it's so easy but I couldn't find any proper answer in google or here!!
I did use
\File::copyDirectory('public/' . $token . '/cover/', $folderName . '/cover/');
but there's no different!!
This is where I found above solution.
Do you know how can I copy entire directory from one folder to another using laravel 5.4?
Thanks in Advance