Ftp


#1

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?


#2

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.


#3

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.


#4

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.


#5

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/