Velocity Reviews - Computer Hardware Reviews

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

Reply
Thread Tools

another FTP modules problem

 
 
Greg Brondo
Guest
Posts: n/a
 
      05-30-2004
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
(EOFError)
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 Time.now.to_s + " :: #{msg}"
end

def chmodFiles(conn, dir)
conn.chdir(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
printInfo(pwd)
chmodFiles(conn, fileName)
conn.chdir("..")
end
}
end

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

printInfo("Permissions = #{PERMISSIONS}")
printInfo("Start Dir = #{STARTDIR}")

Net::FTP.open(HOST) { |conn|
conn.login("blahuser", "blahpass")
chmodFiles(conn, STARTDIR)
}


 
Reply With Quote
 
 
 
Reply

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



Advertisments