From: Casimir P Date: 2007-11-21T07:20:05+09:00 Subject: Re: Libs for high-level file processing? > -------- Original-Nachricht -------- >> Datum: Tue, 20 Nov 2007 20:15:04 +0900 Von: Casimir >> An: ruby-talk@ruby-lang.org >> Betreff: Libs for high-level file processing? > >> Is there anything you comp.lang.ruby readers would recommend that would >> abstract away things like "if file load fails" or "if file not found" >> or "index of all .xml -files in the subdirs"? >> On Tue, 20 Nov 2007 10:06:36 -0500, Axel Etzold wrote: > Dear Casimir, > ... > mmh - maybe rio can help? http://rio.rubyforge.org/ > On Tue, 20 Nov 2007 11:49:30 -0500, Robert Klemme wrote: > > ...You can do > > File.open("foo") do |io| > end resuce nil > > if File.exists? "foo" > > xml_files = Dir["bas/**/*.xml"] > > Which is pretty small I'd say. What am I missing? I admint! I is dummy! IT's easy! 8) Dir['/home/kasbah/*.jpg' && '/home/kasbah/*.png'].sort!.each { |f| puts f.to_s } But then its not that short: if File.exists? $imgSourcePathStr if File.exists? $imgDestPathStr indexedDirs = indexImagesInDirs ($imgSourcePathStrs, $imgDestPathStr) else puts "no dest!" exit end else puts "no src!" exit end indexedDirs.each { |one| path=one[0] num=0 one.flatten!.length < 8 ? num = (one.length.to_i-1) : num = 7 num.times { |m| puts "converting (" + (m+1).to_s + "/" + num.to_s + ")" imgname = one[(m+1)] savesubpath = path.split("/").last saveresized = savetargetstr.to_s + "/" + path.split("/").last + "/" + (m+1).to_s + "fullsize" + imageFormat #and then write and FAIL.. #Double slash kills.. #Or directory doesnt exist! #Its all too complicated :( #I is dum! } } Csmr -- Casimir Pohjanraito Art Portfolio: http://csmr.dreamhosters.com