From: ara.t.howard@... Date: 2006-07-10T00:41:38+09:00 Subject: Re: renaming files randomly On Mon, 10 Jul 2006 Ara.T.Howard@noaa.gov wrote: > this loop loses data > > if > > files = %w( a b c ) > > and > > new_names = %w( c b a ) > > then the renaming order is > > a -->> c > b -->> b > c -->> a > > so > > File.rename 'a', 'c' # c is clobbered > File.rename 'b', 'b' # ok > File.rename 'c', 'a' # a is clobbered, new c is lost > > at the end of the loop you'll have only files 'a' and 'b' and no error will > have been thrown. sorry - replace 'a b c' with '1 2 3' and 'c b a' with '3 2 1' - basically you lose data when the slides have numbered names to begin with, which i noticed because this is exactly how my slideshow software names it's slides! ;-) -a -- suffering increases your inner strength. also, the wishing for suffering makes the suffering disappear. - h.h. the 14th dali lama