copy *.* troubles
| From: | Malcolm | Date: | Sun, 16 Feb 2003 15:48:53 +0000 |
| Subject: | copy *.* troubles | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-135753@lists.php.net to get a copy of this message | ||
Hello List,
I'm having trouble with copy. I have this script that I got from php.net but I can't figure out how to set the path. Right now it doesn't complain but no files are copied. I'm trying to use a dynamically set directory to do this, I have included ml_config to make the vars available. That's why the $listname in the to_path. I want all the files from /maillist to got to /$listname, I've tried all kinds of slashes, dots and anything else but I can't seem to copy any files. It echos files copied at the end but it lies. Here's the script ;
<?
include "ml_config.php";
$from_path ="/aamaillist/maillist05";
$to_path = "/aamaillist/$listname";
function rec_copy ($from_path, $to_path) {
if(!is_dir($to_path))
{
mkdir($to_path, 0777);
}
if ($handle = opendir($from_path))
{
while (false !== ($file = readdir($handle))) {
if ($file != "." && $file != "..") { if (is_file($from_path."/".$file))
{
copy($from_path."/".$file,$to_path."/".$file);
}
elseif ( is_dir($from_path."/".$file) )
{
rec_copy($from_path."/".$file,$to_path."/".$file);
}
}
}
}
}
echo "files copied from $from_path<br>";
echo " files copied to $to_path<br>";
echo "$PHP_SELF";
?>
Anyone see obvious errors or offer another way ?
malcolm
--
--
Using M2, Opera's revolutionary e-mail client: http://www.opera.com/m2/