Forum: Ruby FTP

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
FTP
Philip P. (Guest)
on 2008-12-20 02:59
Hi,
I'm a complete novice to Ruby, but I would like to write an FTP server
to collect the files from my computer (internet connected) and copy them
to my server nightly. My server is a Ubuntu Linux setup with FTP and
blah. Please help me with this?
Jeremy H. (Guest)
on 2008-12-20 04:35
(Received via mailing list)
On 2008-12-20, Philip P. <removed_email_address@domain.invalid> wrote:

> I'm a  complete novice  to Ruby, but  I would  like to write  an FTP
> server to  collect the files  from my computer  (internet connected)
> and copy  them to  my server  nightly. My server  is a  Ubuntu Linux
> setup with FTP and blah. Please help me with this?

Do  you need  to  do any  programming  at all?   The  NcFTP client  at
http://www.ncftp.com/ncftp/ can  recursively download directories from
an FTP server to the local machine.  I have used it to do that myself.
Is that not enough?  Not that  I want to put you off Ruby programming,
but it doesn't seem necessary in this case.

Regards,

Jeremy H.
Philip P. (Guest)
on 2008-12-20 16:04
Jeremy H. wrote:
> On 2008-12-20, Philip P. <removed_email_address@domain.invalid> wrote:
>
>> I'm a  complete novice  to Ruby, but  I would  like to write  an FTP
>> server to  collect the files  from my computer  (internet connected)
>> and copy  them to  my server  nightly. My server  is a  Ubuntu Linux
>> setup with FTP and blah. Please help me with this?
>
> Do  you need  to  do any  programming  at all?   The  NcFTP client  at
> http://www.ncftp.com/ncftp/ can  recursively download directories from
> an FTP server to the local machine.  I have used it to do that myself.
> Is that not enough?  Not that  I want to put you off Ruby programming,
> but it doesn't seem necessary in this case.
>
> Regards,
>
> Jeremy H.

I would like to do this as a technical excercise first of all, plus I
want it to do specific things at certain times like upload all files in
a folder at 9PM every night, etc plus I want it to run from my Ubuntu
server.
Jeremy H. (Guest)
on 2008-12-22 03:30
(Received via mailing list)
On 2008-12-20, Philip P. <removed_email_address@domain.invalid> wrote:

> I would like to do this as a technical excercise first of all, plus
> I want it to do specific things at certain times like upload all
> files in a folder at 9PM every night, etc plus I want it to run from
> my Ubuntu server.

If you want it to run from your server then I think you'll have to
have some kind of mini-server on your local machine for your Ubuntu
box to contact.  That could be something standard such as ssh, which
would let your server log in and scp files.  Or perhaps FTP, and you
could script it with Net::FTP.  If you really want to do it all
yourself you could write a server and client with DRb.  That would be
interesting!  Of course you'd have to figure out the security
implications of all this.

Regards,

Jeremy H.
Robert H. (Guest)
on 2008-12-22 12:22
> plus I want it to do specific things at certain times like upload all
> files in a folder at 9PM every night

This is not so complicated.

First you should write a simple FTP "client" that connects to your
host. This is quite trivial, i.e.

  x = Net::FTP.new('ftp.members.a1.net')
  x.login('your_name','your_password')

Just look at the FTP class in ruby.

Once you can upload files, you can let this script run
at fixed times. One way would be with cron, or with
ruby daemons http://rubyforge.org/projects/daemons/
This topic is locked and can not be replied to.