Does anyone have time to run this code? This is definitely weird. Either a Windows or a code problem. If I set:
$to_path = "c:\\ccl_www\\".$date."ccl_www\\"; to: $to_path = "c:\\ccl_www\\".$date."\\ccl_www\\"; (I add \\) It fails to create c:\ccl_www\20020315\ccl_www, but otherwise will create c:\ccl_www\20020315ccl_www I've tried debugging this thing backwards, but have not found my problem. If for example, I tried creating manually: c:\ccl_www thinking it was a root thing. It worked, then it didn't. :x( John P.S. By the by, I tried this on a Unix box, and thought it worked, but then it didn't when I went back to it this morning. I'm confused! ------------snip------------ $date = date ("MD"); ####################################### ### Don't forget trailing slash ##### ####################################### $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