# Net::FTP list empty

**URL:** <https://www.ruby-forum.com/t/net-ftp-list-empty/167925>\
**Category:** Ruby\
**Created:** [May 14, 2009, 2:09am UTC](https://www.ruby-forum.com/t/net-ftp-list-empty/167925 "2009-05-14T02:09:21Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [May 14, 2009, 2:09am UTC](https://www.ruby-forum.com/t/net-ftp-list-empty/167925/1 "2009-05-14T02:09:21Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![S-gw](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/s/ed655f/32.png) [@S-gw](https://www.ruby-forum.com/u/S-gw)\
**Post date:** [May 14, 2009, 2:14am UTC](https://www.ruby-forum.com/t/net-ftp-list-empty/167925/2 "2009-05-14T02:14:08Z")

</div>

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
