From: Todd Smith Date: 2001-05-29T14:10:04+09:00 Subject: [ruby-talk:15907] Re: Dir[] "Wayne Blair" wrote in message news:7pFQ6.35025$v5.2948569@news1.rdc1.ct.home.com... > files=Dir["C:/dir?dir1/next?dir2/*"] > > OR > > files=Dir["C:/dir[^a-z]dir1/next[^a-z]dir2/*"] > That didn't work for me (on Windows 2000). Here's my little windows script- it asks for a directory, then prints out all the files in that directory into the multi-selection box. You'll notice that it works for paths with no spaces, but doesn't for those with spaces. ----------------------------- require 'tk' root = TkRoot.new { title "File Browser" } mainF = TkFrame.new(root) { relief 'sunken' borderwidth 2 } fileL = TkListbox.new(mainF, 'selectmode' => 'multiple') { setgrid 1 height 10 width 80 } scroll_bar = TkScrollbar.new(mainF, 'command' => proc { |*args| fileL.yview *args }) scroll_bar.pack('side' => 'left', 'fill' => 'y') fileL.pack mainF.pack dir = fileL.chooseDirectory.concat("/*") # HERE ######################## dir.gsub!(/ /, "?") ################################# fileL.insert('end', dir) files = Dir[dir] files.each{ |f| type = File.ftype(f) fileL.insert('end', f) if type.eql?("file") } Tk.mainloop