From: Robert Klemme Date: 2005-05-13T23:55:28+09:00 Subject: Re: Go through directories recursively 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. Kind regards robert