On Jul 17, 2007, at 8:59 PM, Todd Benson wrote:
<snip>
>
> Well there's #nlst method (using openbsd site as an example):
>
> require 'net/ftp'
> names = nil
> Net::FTP.open('ftp.openbsd.org','anonymous','blah') do |ftp|
>  ftp.chdir('/pub/OpenBSD/4.1')
>  names = ftp.nlst('*')
> end
> p names
>
> That will give you the names of directories _and_ files _and_ links in
> the 4.1 directory.
>
> If you want just the directories in a directory, you can do this:
>
> require 'net/ftp'
> dirs = []
> Net::FTP.open('ftp.openbsd.org', 'anonymous', 'blah') do |ftp|
>  ftp.chdir('/pub/OpenBSD/4.1')
>  dirs = ftp.ls('*').select { |item| item[0,1]=~/^[l|d]/ }
> end
> dirs.map! { |item| item.split.last }
> p dirs
>
> That will give you just the directory and link names in the 4.1
> directory (but not if they have spaces in the name).

mmmmmm yes it finally makes sense! But when you did your ls... Did  
you get the listing of every file IN every directory? Because thats  
what I get when I use dir.


aRi
-------------------------------------------|
Nietzsche is my copilot