Miguel,
No, You're right I wasn't running E=All.  It's a windows machine, so I have
all the write priveledges I want.
These are the errors I'm getting:

     Warning: stat failed for c:\ccl_www\MarFriccl_www\ (errno=2 - No such
file or
     directory) in C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
     Warning: MkDir failed (No such file or directory) in
     C:\WINDOWS\Bureau\php\microweb\backup4.php on line 24
     Warning: stat failed for c:\ccl_www\MarFriccl_www\Nouveau dossier/
     (errno=2 - No such file or directory) in
     C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
     Warning: MkDir failed (No such file or directory) in
     C:\WINDOWS\Bureau\php\microweb\backup4.php on line 24
     Warning: Unable to create 'c:\ccl_www\MarFriccl_www\Nouveau
     dossier/aa.txt': No such file or directory in
     C:\WINDOWS\Bureau\php\microweb\backup4.php on line 44
     Warning: Unable to create 'c:\ccl_www\MarFriccl_www\aa.txt': No such
file or
     directory in  C:\WINDOWS\Bureau\php\microweb\backup4.php on line 44
     files copies from c:\program files\easyphp\ccl_www\ and backed up to
     c:\ccl_www\MarFriccl_www\

The code calls itself each time it enters another level.
If I create c:\ccl_www myself, I get this error:

     Warning: stat failed for c:\ccl_www\MarFriccl_www\ (errno=2 - No such
file or
     directory) in C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
     Warning: stat failed for c:\ccl_www\MarFriccl_www\Nouveau dossier/
     (errno=2 - No such file or directory) in
C:\WINDOWS\Bureau\php\microweb\backup4.php on line 23
     files copies from c:\program files\easyphp\ccl_www\ and backed up to
     c:\ccl_www\MarFriccl_www\

But despite "(errno=2 - No such file or directory)" the code does create
c:\ccl_www\MarFriccl_www and does copy the necessary files.

Can anyone help?


---------snip--------------
$date = date ("MD");
$from_path = "c:\\program files\\easyphp\\ccl_www\\";
$to_path = "c:\\ccl_www\\".$date."ccl_www\\";

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);

$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