Ruby ftp class help

G

Greg Brondo

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.
 
J

jm

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

jm.

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
 
G

Greg Brondo

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top