another FTP modules problem

Discussion in 'Ruby' started by Greg Brondo, May 30, 2004.

  1. Greg Brondo

    Greg Brondo Guest

    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)
    }
    Greg Brondo, May 30, 2004
    #1
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. someone

    FTP over SSL vs FTP over SSH

    someone, Apr 24, 2004, in forum: Java
    Replies:
    1
    Views:
    4,578
    iksrazal
    Apr 25, 2004
  2. Replies:
    3
    Views:
    5,619
  3. Nico Grubert
    Replies:
    0
    Views:
    637
    Nico Grubert
    Nov 24, 2005
  4. Vin Raja

    FTP : Time problem (net/ftp)

    Vin Raja, Jun 7, 2007, in forum: Ruby
    Replies:
    0
    Views:
    100
    Vin Raja
    Jun 7, 2007
  5. D. Buck
    Replies:
    2
    Views:
    477
    D. Buck
    Jun 29, 2004
Loading...

Share This Page