this code used to work but for some weird reason its been broken since upgrade to php 5 and i just can't troubleshoot it.
basically, all it does it get a listing of files from dir1 and moves all the files to dir2.
the ftp account is fine, it logs in ok based on my debugging. the error it yields is in the RNFR command for ftp where it complaints there's an error, although i don't see why!
basically, all it does it get a listing of files from dir1 and moves all the files to dir2.
the ftp account is fine, it logs in ok based on my debugging. the error it yields is in the RNFR command for ftp where it complaints there's an error, although i don't see why!
<?
$dir1 = 'home/dir1'; //directory move files from
$dir2 = 'home/dir2'; //directory move files to
//establish ftp connection
$conn_id = ftp_connect("hostname");
$login_result = ftp_login($conn_id, "user", "password");
//builds lists of files to move. they're stored as home/dir1/<filename>
$filestomove = ftp_nlist($conn_id, $dir1);
//foreach command that moves each file into dir2
foreach($filestomove as $file)
{
$filesfrom = $dir1.$file; // i tried this as just $file too, no luck
$filesto = $dir2.$file;
echo "Moving ".$file;
echo "<br>";
ftp_rename($conn_id, $filesfrom, $filesto);
}
//closes ftp session
ftp_close($conn_id);
?>
