Ver Mensaje Individual
  #6 (permalink)  
Antiguo 26/06/2003, 07:54
cascompany
Invitado
 
Mensajes: n/a
Puntos:
Tambien esto te pueda ayudar ...

Cita:
Here is a function that will recursively copy a file into every directory within a specified directory, unless the directory is in an optional third parameter, an array with a list of directory names to skip. It will also print whether it copied each item it expected to.

NEW: Apparently, if you try to copy a file to itself in PHP, you end up with an empty file. To alleviate this, I added a fourth parameter, also optional, which is the number of levels to skip when copying files. The default is 0, which will only skip the directory specified in $dir, so that a call using the file's directory will work properly. I would not recommend calling this function with a directory higher up the tree than the file's.

Código PHP:

<?php 
function copyintodir ($file, $dir, $skip = array(''), $level_count = 0) { 
 if (
count($skip) == 1) { 
  
$skip = array("$skip"); 
 } 
 if (!@(
$thisdir = opendir($dir))) { 
   print 
"could not open $dir<br />"; 
   return; 
 } 
 while (
$item = readdir($thisdir) ) { 
   if (
is_dir("$dir/$item") && (substr("$item", 0, 1) != '.') && (!in_array($item, $skip))) { 
     
copyintodir($file, "$dir/$item", $skip, $level_count + 1); 
   } 
 } 
if (
$level_count > 0) 
   if (@
copy($file, "$dir/$file")) { 
     print 
"Copied $file into $dir/$file<br />\n"; 
   } else { 
     print 
"Could not copy $file into $dir/$file<br />\n"; 
   } 
} 
} 
?>
Oh mira mas info de esto por aqui : http://www.php.net/manual/en/function.copy.php

Si haces funcionar un php asi como quieres, una vez que copia lo que quieres donde quieres, nomás lo agregas al CRONJOB y listo... desde yá, está ver si tu host/server lo soporta o lo permite.

Saludos