Does anyone know of a product or script or can they provide a script that will allow direct FTP to FTP transfer of files.
I need this both for same server and also different server purposes.
Thanks in advance
GW
Does anyone know of a product or script or can they provide a script that will allow direct FTP to FTP transfer of files.
I need this both for same server and also different server purposes.
Thanks in advance
GW
1st rule of web development - use Firefox and Firebug
2nd rule - see the first rule
--
I like Smilies
You can use PHP and it's a very fast way to transfer between servers. It's a little hard to use, but you can try this script; it's what I use.
To use: place this on the origin server and configure it for your destination server; then it will move the files there. Be careful using this!PHP Code://FTP FULL TRANSFER FUNCTION:
//CONNECT
//set up basic connection
$conn_id = ftp_connect('ftp.REMOTEDOMAIN.com');
//login with username and password
$login_result = ftp_login($conn_id, 'USER', 'PASS');
//END CONNECT
set_time_limit(0); //let run forever
function ftp_putAll($conn_id, $src_dir, $dst_dir) {
$d = dir($src_dir);
while($file = $d->read()) { // do this for each file in the directory
if ($file != "." && $file != "..") { // to prevent an infinite loop
if (is_dir($src_dir."/".$file)) { // do the following if it is a directory
if (!@ftp_nlist($conn_id, $dst_dir."/".$file)) {
ftp_mkdir($conn_id, $dst_dir."/".$file); // create directories that do not yet exist
echo $src_dir.'/'.$file.'<br>'."\n";//report
}
ftp_putAll($conn_id, $src_dir."/".$file, $dst_dir."/".$file); // recursive part
}
else {
$upload = ftp_put($conn_id, $dst_dir."/".$file, $src_dir."/".$file, FTP_BINARY); // put the files
echo $src_dir.'/'.$file.'<br>'."\n";//report
}
}
}
$d->close();
}
ftp_putAll($conn_id,'.','remotedir/');
Note: if the line that sets the time limit to unlimited does not work on your server, the transfer may time out. This means you may need to do it manually or split it into several transfers.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Cheers for that, does this transfer everything from the origin or just the files you want it to?
Thanks
GW
1st rule of web development - use Firefox and Firebug
2nd rule - see the first rule
--
I like Smilies
Set $src_dir (source directory) and $dst_dir (destination directory) as desired.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
Excellent, thanks Daniel
1st rule of web development - use Firefox and Firebug
2nd rule - see the first rule
--
I like Smilies
Sorry I must not understand it properly, I am getting errors in testing like
Warning: ftp_mkdir() [function.ftp-mkdir]: Can't create directory: No such file or directory in /home/mysite/public_html/temp/ftp-to-ftp.php on line 17
./temp
Warning: ftp_put() [function.ftp-put]: Can't open that file: No such file or directory in /home/mysite/public_html/temp/ftp-to-ftp.php on line 23
./temp/albums.tar.gz
Where I have a temporary directory in web accessible space and have the ftp-to-ftp.php file just below that
I set the $src_dir = 'temp'; and also tried a few other deviations such as full path.
What did I do wrong?
Thanks for your help
GW
1st rule of web development - use Firefox and Firebug
2nd rule - see the first rule
--
I like Smilies
It may take some trial and error to figure out exactly how to use this. As I said, it's what I use myself, but it's not exactly user-friendly.
Remember, this is going from your current server to your new server. It sounds like you might be doing that backwards, so the directories you've made don't correspond to the right directions. (I'm not sure that's the case.)
Also, there might be problems with file permissions on the source server. On the destination server, it will be like FTP, so there should not be any problems.
Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum
you are correct, trial and error and I got it to work.
Cheers
GW
1st rule of web development - use Firefox and Firebug
2nd rule - see the first rule
--
I like Smilies
Bookmarks