From: Tommy Nordgren Date: 2009-01-26T08:33:35+09:00 Subject: Whats wrong with this script? #!/usr/bin/ruby $headersumfile = File.open("Header-summary.txt","w"); $finalizerfile = File.open("Finalizers.m","w"); def scanfiles(dirhand, dirname) dirhand.each { | fn | if (fn == '.' || fn == '..') elsif (fn =~ /\.m$/) File.open("#{dirname}/#{fn}","r") { | f | f.each { | l | $finalizerfile.puts(l); } } elsif (fn =~ /\.h$/) File.open("#{dirname}/#{fn}","r") { | f | f.each { | l | $headersumfilefile.puts(l); } } elsif (File.directory?("#{dirname}/#{fn}")) scanfiles(Dir.open("#{dirname}/#{fn}"),"#{dirname}/#{fn}") end } dirhand.close; end scanfiles(Dir.open("Source"),"Source"); $finalizerfile.close; $headersumfile.close; Message from terminal: emac$ ./extractdata.rb ./extractdata.rb:21:in `scanfiles': private method `puts' called for nil:NilClass (NoMethodError) from ./extractdata.rb:20:in `each' from ./extractdata.rb:20:in `scanfiles' from ./extractdata.rb:19:in `open' from ./extractdata.rb:19:in `scanfiles' from ./extractdata.rb:9:in `each' from ./extractdata.rb:9:in `scanfiles' from ./extractdata.rb:25:in `scanfiles' from ./extractdata.rb:9:in `each' from ./extractdata.rb:9:in `scanfiles' from ./extractdata.rb:31 Work Directory: ~/Desktop/Drawkit/DrawKit/Trunk : The script are supposed to copy objective source and header files to a pair of files. The directory to be scanned exists in my current work directory. Can someone please help ---------------------------------- Skinheads are so tired of immigration, that they are going to move to a country that don't accept immigrants! Tommy Nordgren tommy.nordgren@comhem.se