From: Eric Hodel Date: 2004-10-10T03:24:39+09:00 Subject: Re: Two rescues? --2VXyA7JGja7B50zs Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable STEPHEN BECKER I V (Becker004@gmail.com) wrote: > end.each do |dir| >=20 > newname=3D"file.new"#$a.slice(1..(2+rand(225)))+".rb" > #randomly choose size >=20 > newloc=3D File::join(path, dir,newname) #create new file location >=20 > print newloc,"\n" >=20 > File.copy File.expand_path(__FILE__), newloc #danger >=20 > begin >=20 > recurse(File::join(path, dir), max_depth - 1) if max_depth > 0=20 > rescue Errno::EACCES,Errno::ENOENT =3D> e=20 >=20 > end >=20 > end >=20 >=20 > /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? Maybe you want to use Find.find. (require 'find') --=20 Eric Hodel - drbrain@segment7.net - http://segment7.net All messages signed with fingerprint: FEC2 57F1 D465 EB15 5D6E 7C11 332A 551C 796C 9F04 --2VXyA7JGja7B50zs Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.2.2 (FreeBSD) iD8DBQFBaCzkMypVHHlsnwQRAliyAKDNv8SFI7ljIHgnYXhpItfCna+vBgCg4nQT dYZrebXLxK8eY1YOUp0bB1g= =4OCB -----END PGP SIGNATURE----- --2VXyA7JGja7B50zs--