C
Casimir P
Hehe whoever said that ruby is not verbose was WRONG!! 
I mean look at the code below!
All this just to find subdirectories and to list all the jpg files inside!!
So... NOT!!!
I hope the code posts well..
#code starts here
imgpath = "img/"
def seekPhotoDirs(path)
require 'find'
photodirs = Array.new
Find.find(path) do |item|
if FileTest.directory?(item)
if item != path #ei haluta tätä samaa hakemistoa
puts indexImages(item)
end
end
end
return photodirs
end
def indexImages(dir)
dir.each { |d|
Dir.entries(d).each { |filu|
nn = filu.to_s
ext = filu.downcase.split(".").last
if ( ext == "png" || ext == "jpg")
puts filu
end
}
}
end
puts seekPhotoDirs(imgpath)
#code ends here
Greetings to whytheluckystiff! Outfoxed, not sourced.
Csmr
I mean look at the code below!
All this just to find subdirectories and to list all the jpg files inside!!
So... NOT!!!
#code starts here
imgpath = "img/"
def seekPhotoDirs(path)
require 'find'
photodirs = Array.new
Find.find(path) do |item|
if FileTest.directory?(item)
if item != path #ei haluta tätä samaa hakemistoa
puts indexImages(item)
end
end
end
return photodirs
end
def indexImages(dir)
dir.each { |d|
Dir.entries(d).each { |filu|
nn = filu.to_s
ext = filu.downcase.split(".").last
if ( ext == "png" || ext == "jpg")
puts filu
end
}
}
end
puts seekPhotoDirs(imgpath)
#code ends here
Greetings to whytheluckystiff! Outfoxed, not sourced.
Csmr