Copying Multiple Files from One Server to Another Server
| From: | Wei, Alice J. | Date: | Wed, 16 Jul 2008 17:34:56 +0000 |
| Subject: | Copying Multiple Files from One Server to Another Server | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-276924@lists.php.net to get a copy of this message | ||
Hi,
I am running into a problem here with handling the files. My client wants me to copy all the files
to one server over to another server. Currently, I use a very slow way that has to handle my code by
writing in and out files manually as in the following:
$lines3 = file("http://192.168.10.63/test/B1Depth-$id.dat");
$file3="http://192.168.10.63/test/B1Depth-$id.dat";
$count3= count($lines3);
$ourFileName3 = "C:/Inetpub/wwwroot/test/B1Depth-$beam_id.dat";
$ourFileHandle3 = fopen($ourFileName3, 'wb') or die("can't open file");
$newFileHandle3 = fopen($ourFileName3, 'a') or die("can't open file");
for ($i = 0; $i<=1; $i++) {
rtrim($lines3[$i]);
echo $lines3[$i] . "<br>";
$content= fwrite($ourFileHandle3, $lines3[$i]);
}
fclose($ourFileHandle3);
for ($i = 2; $i <=$count3; $i++) {
rtrim($lines3[$i]);
echo $lines3[$i] . "<br>";
$content= fwrite($newFileHandle3, $lines3[$i]);
}
fclose($newFileHandle3);
Is there some way that I can do something like a cp and copy it over? Or, how should I go about
doing this without going through this manually, since I won't be able to know how many files
that would be needed to be copied?
I would welcome any suggestions on this.
Alice
======================================================
Alice Wei
MIS 2009
School of Library and Information Science
Indiana University Bloomington
ajwei@indiana.edu