Using ftp for recursive copying

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
skunkthemonk
Forum Newbie
Posts: 5
Joined: Tue Jul 15, 2003 3:44 am

Using ftp for recursive copying

Post 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 :(
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post 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().
skunkthemonk
Forum Newbie
Posts: 5
Joined: Tue Jul 15, 2003 3:44 am

ftp recursive copy

Post by skunkthemonk »

I'm using linux redhat 9 and the servers use the same
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post 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.
skunkthemonk
Forum Newbie
Posts: 5
Joined: Tue Jul 15, 2003 3:44 am

thanks

Post by skunkthemonk »

thanks for the help i''ll take a look at the links

Cheers
Jeremy :D
skunkthemonk
Forum Newbie
Posts: 5
Joined: Tue Jul 15, 2003 3:44 am

Won't work

Post 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)
User avatar
Heavy
Forum Contributor
Posts: 478
Joined: Sun Sep 22, 2002 7:36 am
Location: Viksjöfors, Hälsingland, Sweden
Contact:

Post 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.
Post Reply