How to synchronize files, from FTP to computer?

Hello,
I'm looking for the best way to synchronize files between my computers
and my FTP.

If you know Dropbox, I'm looking for a way to do the same thing with
Ruby for a personnal project.

If there is a project (a rubyforge one for example) to do it, I will use
it, but if not, I write down a short list of what I think I will need :

1- the best way to upload files

2- the best way to download files

3- the best way to compare files and make a diff patch

4- upload only the modified parts of the files thanks to the diff patch
(or access an online file in "w+" mode)

5- download only the modified parts of the files thanks to the diff
patch
(or read from an online file from pos x to pos y)

I know points 4 and 5 are a bit hard (and much harder if you have a
non-rails FTP) , but if you can help me only with ONE of these points,
thank you.

I have several projects which use only one or two of these points, and I
could improve greatly their performances thanks to your help.

···

__

About one of these points :

2- the best way to download files

I tried open-uri, but I downloaded files faster with Mechanize.
What's your opinion about that ?

__

(I'm french, sorry for my mistakes)
--
Posted via http://www.ruby-forum.com/.

Marc-antoine Kruzik wrote:

Hello,
I'm looking for the best way to synchronize files between my computers
and my FTP.

If you know Dropbox, I'm looking for a way to do the same thing with
Ruby for a personnal project.

Can you use rsync or unison? Or do you really want to reimplement that functionality in ruby? Or maybe you are forced to use the ftp protocol for some reason?

Joel VanderWerf wrote:

Can you use rsync or unison? Or do you really want to reimplement that
functionality in ruby? Or maybe you are forced to use the ftp protocol
for some reason?

I didn't know these two projects. Thank you for giving me the names.
I found this about rsync :
http://rubyforge.org/projects/six-rsync/
http://snippets.dzone.com/posts/show/7003

I'm on Windows, but I think I can use rsync or unison with command line
parameters from my ruby application, can't I ?

I don't think I'm forced to use the FTP protocol, it's just that it's
the main way I access my datas. I will do some tests to look if I can
use other protocols.

···

--
Posted via http://www.ruby-forum.com/\.

Marc-antoine Kruzik wrote:

I'm on Windows, but I think I can use rsync or unison with command line parameters from my ruby application, can't I ?

Yes, I think there are native win32 ports of rsync. If all else fails, you can run rsync from cygwin. In any case, it's not hard to use the system() or popen() methods to run an external command from ruby.

I don't think I'm forced to use the FTP protocol, it's just that it's the main way I access my datas. I will do some tests to look if I can use other protocols.

As long as you have ssh access, you can use rsync. You don't need to set up an rsync server.