[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: question about .gsub

Ceol

12/17/2006 7:09:00 AM

If the search is simple enough, '**' may be useful:

Dir.glob '/tmp/**/*.jpg'

returns an array of all of the *.jpg files in or below /tmp:

irb(main):017:0> puts Pathname.glob '/tmp/**/*.wav'
(irb):17: warning: parenthesize argument(s) for future version
/tmp/8ac6ad1933905c064429ffad284508094daccc0d.wav
/tmp/mocktmp43800.wav
/tmp/mocktmp77244.wav
/tmp/testforfileappender_1.wav
/tmp/testforfileappender_2.wav
/tmp/custaudio/7/snark-2-1.wav
/tmp/custaudio/7/snark-2-2.wav
/tmp/custaudio/7/snark-2-3.wav
=> nil
irb(main):018:0>

or '/tmp/**/' will get you a directory tree.

- James Moore