From: Dan Kohn Date: 2005-12-31T20:11:14+09:00 Subject: Re: Directory and file listing I'm not familiar with sketchup, but I can at least show you how iterations through an array should look: dir=gets Dir.chdir dir images=Dir["*.jpg"] images.each do |img| material_importer( img) end def material_importer( img) m = Sketchup.new m.sample_name = img m.filename = img + ".jpg" m.save end In other words, pass each element of the array (img) to your method (material_importer) and then do something with it there. You shouldn't meed to access the full array (images) from the method.