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?

Was it helpful?

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
scroll top