>looks good to me - only screwy thing I can think of is the backslash thing -
>REALLY annoying - and confusing sometimes....

Yeah, no kidding. Thanks Martin!

What about if I try copying $to_path onto a Network server?

Do you see any problems with the code and $to_path?

(Not that I have a server to test it on yet. Not that Works &
Services are going to take 2 weeks :-( to replace my stolen server!
But I have to prepare for the inevitable.)

---------------snip-------------------------------------
$date = date ("Ymd");
$from_path = getcwd()."\\mysql\\";
$to_path = "/sirius/data/usager/ccl/backups/".$date."/";

if(!is_dir($from_path))
{
echo "failed";
exit;
}else{
rec_copy($from_path, $to_path);
echo "files copies from $from_path and backed up to $to_path";
}

#########################################################################
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
mkdir($to_path, 0777);

#if(mkdir($to_path, 0777))
# {mkdir($to_path, 0777);}

$this_path = getcwd();
 if (is_dir($from_path))
 {
    chdir($from_path);
    $handle=opendir('.');

    while (($file = readdir($handle))!==false)
    {
 if (($file != ".") && ($file != "..")) {
  if (is_dir($file))
  {
  rec_copy ($from_path.$file."/",  $to_path.$file."/");
       chdir($from_path);
  }else{
#  echo "error if (is_dir($file))<br>";
  }
  if (is_file($file))
  {
  copy($from_path.$file, $to_path.$file);
  }else{
#  echo "error copy($from_path.$file, $to_path.$file)<br>";
  }
 }#end (($file != ".")
    }#end while (($file

    closedir($handle);
 }# end if (is_dir
 else{
# echo "if (is_dir($from_path))<br>";
 }
}# end function



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to