From: zuo peng Date: 2008-05-28T13:47:11+09:00 Subject: Re: Local Jump Error you probably need: src1 << file unless $file_exception[i].all? do |x| /#{x}/i =~ File.basename(file) end On Wed, May 28, 2008 at 10:37 AM, Clement Ow wrote: > Clement Ow wrote: >> Sebastian Hungerecker wrote: >>>> Find.find(src1) do |file| >>>> file.each do |f| >>> >>> find yields the filenames as strings. So file.each will call String#each >>> on the filename. I don't think that that's what you want to do there (as >>> filenames only have one line anyway). >>> >>> HTH, >>> Sebastian >> >> Ok, but if i just put >>>Find.find(src1) do |file| >> and eliminate file.each I get an error in: >> `basename': can't convert Array into String (TypeError) >> >> It seems that there is an array created someway or another.. Is there >> any way i can carry out my code with the consideration that I cant have >> file.each? Or any other way that does the same logic? (all i want to do >> is to search for files in my source paths with some exceptions included >> and then execute commands accordingly(move, copy or delete). Much help >> is appreciated! > > I've finally came out with the code without any errors(after much > debugging): > > if $file_exception[i] != nil > $source.each do |file| > src1 << file unless $file_exception[i].each do |x| > /#{x}/i =~ File.basename(file) > end > end > else > src1 = $source > end > > i = i + 1 > > src1.each do |folder| > Find.find(folder + "/") do |file| > > : > : > > It needs to be broken down into each source path and then from each > source path, you find files recursively. However, there's one problem, > the exception doesnt work at all? Can anyone help me with the rejigging > of the file exception part? Thanks! > -- > Posted via http://www.ruby-forum.com/. > >