The problem with your code is that php does not recognize the *.*
as does windows, so what you should do is go through the directory where the images are to be copied and for each file that you find copy it in the new directory.
$from = 'C:\xampp\htdocs\imagenes';
$to = 'C:\xampp\htdocs\imagenes-copiadas';
//Abro el directorio que voy a leer
$dir = opendir($from);
//Recorro el directorio para leer los archivos que tiene
while(($file = readdir($dir)) !== false){
//Leo todos los archivos excepto . y ..
if(strpos($file, '.') !== 0){
//Copio el archivo manteniendo el mismo nombre en la nueva carpeta
copy($from.'/'.$file, $to.'/'.$file);
}
}
EYE according to the source folder you only have files, if they are inside several folders, you have to modify the code a bit to make it recursive.
ANOTHER VARIANT would use the windows command to copy files, with this if you can use masks like .
$from = 'C:\xampp\htdocs\copy\images\*.*';
$to = 'C:\xampp\htdocs\copy\copy-images';
//Ejecuto el comando para copiar los archivos de la carpeta from a to
exec('copy "'.$from.'" "'.$to.'"');
I HOPE THIS CAN RESOLVE YOUR PROBLEM