From: Ara.T.Howard@... Date: 2005-05-14T00:45:28+09:00 Subject: Re: Go through directories recursively On Fri, 13 May 2005, Robert Klemme wrote: > Karl von Laudermann wrote: > >> Question: what if the operation you want to perform is to delete >> directories or files? From my understanding of Find#find, it yields >> directories breadth-firsh rather than depth first. So if you want to >> delete a directory yielded to your block, do you have to call >> Find#prune on it to avoid messing up the traversal? > > There is a prune method that should do it, although I never used that. See > http://www.ruby-doc.org/stdlib/libdoc/find/rdoc/classes/Find.html#M000002 > >> Likewise for Dir["**/*.jsp"]. Does this form first create an internal >> array of file names before yielding them, or does it yield each file >> as it inspects each directory? If the latter, does the traversal get >> messed up if you delete a file out from under it? > > Dir[] always creates the array first so this is save. Find2 does/can too. -a -- =============================================================================== | email :: ara [dot] t [dot] howard [at] noaa [dot] gov | phone :: 303.497.6469 | renunciation is not getting rid of the things of this world, but accepting | that they pass away. --aitken roshi ===============================================================================