Ruby ftp class help

Ok. I seem to be the one to use the “not-so-well-written” classes in the
distro. Or maybe it’s the lack of docs; dunno but it’s annoying as all get
out. Anyway, I’m trying to write a super simple script to CHMOD a bunch of
files recursively on my web site (ftp access only). When I call
ftp.site(“CHMOD 0755 blahfile”) the process locks. Not sure what is
happening and I don’t have time / nor should I have to fix standard library
code to get my job done (sorry about the tone – I really really want to use
Ruby for more projects but due to the unfinished nature of it I cannot
justify by any means).

Anyone else have issues with the ftp class/module ?

Thanks,
Greg B.

What happens when you ftp in manually and try chmod-ing?

jm.

···

On 25/05/2004, at 1:08 PM, Greg Brondo wrote:

Ok. I seem to be the one to use the “not-so-well-written” classes in
the
distro. Or maybe it’s the lack of docs; dunno but it’s annoying as
all get
out. Anyway, I’m trying to write a super simple script to CHMOD a
bunch of
files recursively on my web site (ftp access only). When I call
ftp.site(“CHMOD 0755 blahfile”) the process locks. Not sure what is
happening and I don’t have time / nor should I have to fix standard
library
code to get my job done (sorry about the tone – I really really want
to use
Ruby for more projects but due to the unfinished nature of it I
cannot
justify by any means).

Anyone else have issues with the ftp class/module ?

Thanks,
Greg B.

Ok, seems the FTP server now disallows the SITE command (it used to work at
my webhost). Anyway, that still doesn’t explain why the class hangs when
sending that command. It should read the “invalid command” response and
exit gracefully or better yet throw an exception I would think…

When I ran a trace (with the set_trace_proc) it seemed to be hanging in a
Thread…Does the ftp class use threading?

Thanks again,
Greg Brondo

“Greg Brondo” greg@brondo.com wrote in message
news:PdmdnXNdzP0ZJS_dRVn-tA@comcast.com

Ok. I seem to be the one to use the “not-so-well-written” classes in the
distro. Or maybe it’s the lack of docs; dunno but it’s annoying as all
get
out. Anyway, I’m trying to write a super simple script to CHMOD a bunch
of
files recursively on my web site (ftp access only). When I call
ftp.site(“CHMOD 0755 blahfile”) the process locks. Not sure what is
happening and I don’t have time / nor should I have to fix standard
library
code to get my job done (sorry about the tone – I really really want to
use

···

Ruby for more projects but due to the unfinished nature of it I cannot
justify by any means).

Anyone else have issues with the ftp class/module ?

Thanks,
Greg B.

The following quick script worked for me. I had to use sendcmd() as I’m
using 1.6 on my laptop and it doesn’t seem to have a site() method.

#!/usr/bin/ruby

require “net/ftp”

f = Net::FTP.new(host,user,pass)
f.passive = true
f.sendcmd(‘site chmod 644 filename’)
f.close()

jm

···

On 25/05/2004, at 1:21 PM, Jeff Miller wrote:

What happens when you ftp in manually and try chmod-ing?

jm.