C
Casimir
....index in a hash...
....all directories under 'src'...
....that contain filetypes in 'ft[]'...
....without getting lost in arrays inside arrays..
#Here is my try
src="/"
tmpindex = []
filetypes = [".jpg", ".png", ".gif", ".bmp"]
filetypes.each { |typ| tmpindex << Dir[src+"**/*"+typ] }
index={}
tmpindex.each { |fpath|
dirpath = File.dirname(File.expand_path(fpath.to_s))
index[dirpath] = File.basename(fpath.to_s)
}
puts index
#bleed
#end
....all directories under 'src'...
....that contain filetypes in 'ft[]'...
....without getting lost in arrays inside arrays..
#Here is my try
src="/"
tmpindex = []
filetypes = [".jpg", ".png", ".gif", ".bmp"]
filetypes.each { |typ| tmpindex << Dir[src+"**/*"+typ] }
index={}
tmpindex.each { |fpath|
dirpath = File.dirname(File.expand_path(fpath.to_s))
index[dirpath] = File.basename(fpath.to_s)
}
puts index
#bleed
#end