PHP shell_exec cp -r
-
02-07-2021 - |
Question
The following PHP code creates a folder called "example.com" inside the "website.com" folder.
$src = "/home/www/example.com/";
$dest = "/home/www/website.com/";
shell_exec("cp -r $src $dest");
How to prevent it from creating a new folder inside the destination folder?
Solution
Add *
:
$src = "/home/www/example.com/*";
$dest = "/home/www/website.com/";
shell_exec("cp -r $src $dest");
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow