Forum: Ruby Net::FTP list empty

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
Greg W. (Guest)
on 2009-05-14 04:09
Ruby 1.8.6. Having trouble getting a file list from an FTP server.

AFAICT the connection itself is valid (connections via GUI apps all work
just fine). Yet every attempt to get a file listing comes up empty or
nil.

#<Net::FTP:0x5ae678 @passive=true,
@last_response="250 CWD command successful.\n",
@sock=#<TCPSocket:0x5ae36c>,
@mon_entering_queue=[],
@binary=true,
@mon_count=0,
@resume=false,
@mon_owner=nil,
@debug_mode=false,
@welcome="230- {blah blah blah} \n",
@last_response_code="250",
@mon_waiting_queue=[]>

I have a method like this (with a couple debug lines):

def connect(host='',user='',password='',origin='')
  connection = Net::FTP.new(host)
  connection.passive = true
  connection.login(user, password)
  connection.chdir(origin)

p connection
p connection.list # .list('*'), .nlst, .dir() all come up empty

  return connection
end

I'm not even sure how to go about debugging this to see why the file
list would be empty.

Any clues appreciated...

-- gw
Greg W. (Guest)
on 2009-05-14 04:14
Greg W. wrote:
> Ruby 1.8.6. Having trouble getting a file list from an FTP server.

Ugh. Nevermind. Had one more thought after I whacked send, and that was
it.

-- gw
This topic is locked and can not be replied to.