Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Ruby > another FTP modules problem

Thread Tools

another FTP modules problem

Greg Brondo
Posts: n/a
Here's the error I receive now (after Guy fixing my first issue):

c:/ruby/lib/ruby/1.8/net/ftp.rb:211:in `readline': End of file reached
from c:/ruby/lib/ruby/1.8/net/ftp.rb:211:in `getline'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:221:in `getmultiline'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:235:in `getresp'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:251:in `voidresp'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:433:in `retrlines'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:419:in `synchronize'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:419:in `retrlines'
from c:/ruby/lib/ruby/1.8/net/ftp.rb:628:in `list'
... 6 levels...
from C:/src/ruby/chmod/ftp_chmod.rb:13:in `chmodFiles'
from C:/src/ruby/chmod/ftp_chmod.rb:35
from C:/src/ruby/chmod/ftp_chmod.rb:33:in `open'
from C:/src/ruby/chmod/ftp_chmod.rb:33

Dunno why I'm getting the EOF. Same basic logic works great in PHP and
Python. Any help would be greatly appreciated.

Here's the code:

require 'net/ftp'

def printInfo(msg)
puts + " :: #{msg}"

def chmodFiles(conn, dir)
pwd = conn.pwd()
dirList = conn.list()
printInfo("file count = #{dirList.length}")
dirList.each() { |entry|
fileName = entry.split()[8]
if entry =~ /^d/ # It's a directory
chmodFiles(conn, fileName)

## Main
HOST = ARGV[0] || "localhost"
PERMISSIONS = ARGV[1] || "0775"
STARTDIR = ARGV[2] || "."

printInfo("Permissions = #{PERMISSIONS}")
printInfo("Start Dir = #{STARTDIR}") { |conn|
conn.login("blahuser", "blahpass")
chmodFiles(conn, STARTDIR)

Reply With Quote

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
FTP : Time problem (net/ftp) Vin Raja Ruby 0 06-07-2007 07:47 AM
Net::FTP problems getting files from Windows FTP server, but not Linux FTP Server. D. Buck Perl Misc 2 06-29-2004 02:05 PM
FTP over SSL vs FTP over SSH someone Java 1 04-25-2004 03:30 PM
imputils - import problem modules from sys.modules Remy Cool Python 1 08-27-2003 02:25 PM