From: STEPHEN BECKER I V Date: 2004-10-09T22:16:04+09:00 Subject: Re: Two rescues? end.each do |dir| newname="file.new"#$a.slice(1..(2+rand(225)))+".rb" #randomly choose size newloc= File::join(path, dir,newname) #create new file location print newloc,"\n" File.copy File.expand_path(__FILE__), newloc #danger begin recurse(File::join(path, dir), max_depth - 1) if max_depth > 0 rescue Errno::EACCES,Errno::ENOENT => e end end /System Volume Information/file.new c:/ruby/lib/ruby/1.8/ftools.rb:67:in `initialize': Permission denied - /System Volume Information/file.new (Errno::EACCES) from c:/ruby/lib/ruby/1.8/ftools.rb:67:in `open' from c:/ruby/lib/ruby/1.8/ftools.rb:67:in `syscopy' from c:/ruby/lib/ruby/1.8/ftools.rb:92:in `copy' from 1.rb:17:in `recurse' from 1.rb:5:in `each' from 1.rb:5:in `recurse' from 1.rb:53 Is there a way to make the loop go to the next? Becker On Sat, 9 Oct 2004 17:50:13 +0900, Florian Frank wrote: > On 2004-10-09 10:20:39 +0900, STEPHEN BECKER I V wrote: > > Can i do this? if not is there a way to jimmy-rig around this? I have > > a program that i want to run on windows and linux but i get differnt > > file errors from the two systems. > > You can do this: > > begin > folder = File.join(path, dir) > recurse(folder, max_depth - 1) if max_depth > 0 > rescue Errno::EACCESS, Errno::SomethingElse => e > STDERR.puts "Caught #{e}: Skipping folder '#{folder}'..." > end > > -- > Florian Frank > >