Page 1 of 1

Using ftp for recursive copying

Posted: Tue Jul 15, 2003 3:44 am
by skunkthemonk
Hi all

I'm busy writing a php script that needs to copy files from one server to another. I would like the copy to be recursive like the cp -r option in linux. Any suggestions

Cheers
Jeremy :(

Posted: Tue Jul 15, 2003 4:12 am
by Heavy
What system are you using? Windows, Linux, freeBSD?

In Unix I would tunnel an rsync through ssh.

rsync copies only what has been changed since last copy, and does this recursively.

ssh is an encrypting tool for accessing remote computers.

These things can be triggered from PHP using the PHP functions exec() or system().

ftp recursive copy

Posted: Tue Jul 15, 2003 4:18 am
by skunkthemonk
I'm using linux redhat 9 and the servers use the same

Posted: Tue Jul 15, 2003 4:20 am
by Heavy
Then I recommend reading the links I provided.
I am 100% shure that those applications are included in the redhat distribution, though I don't use it myself.

thanks

Posted: Tue Jul 15, 2003 4:24 am
by skunkthemonk
thanks for the help i''ll take a look at the links

Cheers
Jeremy :D

Won't work

Posted: Tue Jul 15, 2003 4:31 am
by skunkthemonk
I can't use rsync becuase i'll have to set up a rsync server on every server that i need to use. I'm going to be doing is moving files between a variety of servers. Is thier a php function that could copy recursively. 8)

Posted: Tue Jul 15, 2003 4:53 am
by Heavy
PHP parses script pages. That's its purpose. PHP can USE other utilities. I suggest you check out whether you have openssh installed and use what's provided in there.

Then use scp or sftp instead. they are part of the OpenSSH toolkit and is very common to have installed.
read about it at the SSH page from the link above.

Why ssh?
Because you can set up "secure" connections without having to use passwords and all communication is encrypted. Today I disregard FTP since passwords are passed in plain text over the networks that are involved. SSH is a wonderful thing.