function move($SOURCE, $DESTINATION)
{
chdir($SOURCE);
$DIRECTORY = opendir(getcwd());
while($FILE = readdir($DIRECTORY))
{
if ($FILE == '.' || $FILE == '..') { continue; }
if (is_dir($FILE))
{
echo "<b> $FILE</b><br>";
//echo "mkdir($DESTINATION$FILE, 0700);<br>";
move($SOURCE . "/" . $FILE, $DESTINATION . "/" . $FILE);
//echo "rmdir($DESTINATION$FILE, 0700);<br>";
}
elseif (is_file($FILE))
{
echo " $FILE<br>";
//echo "copy($SOURCE$FILE, $DESTINATION/$FILE);<br>";
//echo "unlink($DESTINATION$FILE);<br>";
}
}
closedir($_DIRECTORY);
}
move("/usr/local/apache/htdocs/fin/efile/storage", "/usr/local/apache/htdocs/fin/efile", "");
This is my function that I am having problems with. I am merely trying to recursivly copy (move) files from one directory to the next. For some reason, when I make a call to move() from within move() the variables get messed up. The result is that only 1 directory is displayed. If I remove the call to move() within the function move() all directories are displayed. I thought that maybe I would have to declare the variables as static, but that doesn't work. Any ideas on how to solve this problem?