No!? $date is a string?!
$date = date ("MD");
Advertising
How does that make a difference?
$to_path = "c:\\ccl_www\\".$date."\\ccl_www\\";
You want me to change it to:
$to_path = "c:\\ccl_www\\$date\\ccl_www\\";
Does anyone follow why?
>Scott Furt wrote:
> I meant, have you created a physical directory
> named $date?
> That's your problem. There's no directory named $date on your computer, and
> you're
> trying to write files into a non-existent directory.
>
> jtjohnston wrote:
> > I have created date :)
> > $date = date ("MD");
> > That's not it. It seems to fail at one level or another, I think, becuase the
> > function calls itself - and probably gets lost somehow.
> > John
> >
> >
> >>... i think you might have to create the
> >>$date directory before writing a file to it.
> >>writing to /tmp/dir/file.txt will fail if
> >>the directory "dir" doesn't exist.
> >>
> >
> > <?php
> >
> > #######################################
> > $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
> >
> > ?>
> >
> >
--
John Taylor-Johnston
-----------------------------------------------------------------------------
' ' ' Collège de Sherbrooke:
ô¿ô http://www.collegesherbrooke.qc.ca/languesmodernes/
- Université de Sherbrooke:
http://compcanlit.ca/
819-569-2064
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php