On Fri, 13 May 2005 nobu.nokada / softhome.net wrote: > Hi, > > At Thu, 12 May 2005 23:25:28 +0900, > Ara.T.Howard / noaa.gov wrote in [ruby-talk:142376]: >> one thing to consider is that neither of these approaches follows links: > > It can cause infinite recursion. find2 watches for this: harp:~/tmp > pwd /home/ahoward/tmp harp:~/tmp > ls harp:~/tmp > ln -s /tmp/ ./link_to_tmp harp:~/tmp > file !$ ./link_to_tmp: symbolic link to /tmp/ harp:~/tmp > ln -s `pwd`/link_to_tmp /tmp/link_to_link_to_tmp harp:~/tmp > file !$ /tmp/link_to_link_to_tmp: symbolic link to /home/ahoward/tmp/link_to_tmp harp:~/tmp > ruby -r alib -e 'ALib::Util::find(:follow=>true){|f| p f}' | tail "./link_to_tmp/pico.964304" "./link_to_tmp/Scha03aTraits.pdf" "./link_to_tmp/jpsock.142_04.25373" "./link_to_tmp/.pico.964304.swp" "./link_to_tmp/foo.txt" "./link_to_tmp/Scha03aTraits.ps" "./link_to_tmp/Duca04wtoplastraitnotfinal.pdf" "./link_to_tmp/TR_CSE_02-012.pdf" "./link_to_tmp/link_to_link_to_tmp" "./link_to_tmp/druby23486.0" harp:~/tmp > ruby -r alib -e 'ALib::Util::find(:follow=>true){|f| p f}' | grep link_to_link "./link_to_tmp/link_to_link_to_tmp" from the find2 code i've incorporated into my personal lib (Alib): # # If `entry_path' is a directory, find recursively. # if stat_result.directory? \ && (!@xdev || @xdev_device == stat_result.dev) \ && (!@follow || !visited?(stat_result)) @dirname_stats.push(stat_result) find_directory(entry_path, block) @dirname_stats.pop end kind regards. -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 ===============================================================================