Am 14 Oct 2007 um 23:55 hat Phrogz geschrieben:
> Dir['/share/music/**/*.mp3', '/share/music/*.mp3']
The above has a flaw.
Dir['/share/music/**/*.mp3'] already includes the *.mp3 in
'/share/music/ itself, so when you add '/share/music/*.mp3' in Dir.glob
you add the *.mp3 from that directory again with the result that you
have them two times in your array:
aaa/
aaa/x.mp3
aaa/bbb/
aaa/bbb/y.mp3
aaa/bbb/ccc
aaa/bbb/ccc/z.mp3
p Dir['aaa/**/*.mp3'].sort
#=> ["aaa/x.mp3", "aaa/bbb/y.mp3", "aaa/bbb/ccc/z.mp3"]
p Dir['aaa/**/*.mp3','aaa/*.mp3'].sort
#=> ["aaa/x.mp3", "aaa/x.mp3",
"aaa/bbb/y.imp3", "aaa/bbb/ccc/z.mp3"]
Dirk Traulsen