# Ruby ftp class help

**URL:** <https://rubytalk.org/t/ruby-ftp-class-help/11725>\
**Category:** ruby-talk\
**Created:** [25 May 2004 03:08 UTC](https://rubytalk.org/t/ruby-ftp-class-help/11725 "2004-05-25T03:08:45Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Greg\_Brondo](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@Greg\_Brondo](https://rubytalk.org/u/Greg_Brondo)\
**Post date:** [25 May 2004 03:08 UTC](https://rubytalk.org/t/ruby-ftp-class-help/11725/1 "2004-05-25T03:08:45Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![jm13](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@jm13](https://rubytalk.org/u/jm13)\
**Post date:** [25 May 2004 03:21 UTC](https://rubytalk.org/t/ruby-ftp-class-help/11725/2 "2004-05-25T03:21:51Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Greg\_Brondo](https://avatars.discourse-cdn.com/v4/letter/g/eada6e/32.png) [@Greg\_Brondo](https://rubytalk.org/u/Greg_Brondo)\
**Post date:** [25 May 2004 03:58 UTC](https://rubytalk.org/t/ruby-ftp-class-help/11725/3 "2004-05-25T03:58:42Z")

</div>

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](mailto:greg@brondo.com) wrote in message  
[news:PdmdnXNdzP0ZJS\_dRVn-tA@comcast.com](mailto: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.

---

<div class="post-metadata">

**Author:** ![jm13](https://avatars.discourse-cdn.com/v4/letter/j/5fc32e/32.png) [@jm13](https://rubytalk.org/u/jm13)\
**Post date:** [25 May 2004 03:52 UTC](https://rubytalk.org/t/ruby-ftp-class-help/11725/4 "2004-05-25T03:52:14Z")

</div>

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.
