Dirk Meijer <hawkman.gelooft / gmail.com> wrote: > this does print the files in proper order, but the point is that i > need the method to be run multiple times in order to export to > multiple html files.. for some reason though, my recursion only runs > once, and it doesn't run the method for the subdirectories in the > subdirectories.. > greetings, Dirk. Hey, where's your creativity? You can do the exporting in find's block. If that does not work, please state your complete requirements and what you are trying to achieve. robert > 2005/11/7, Robert Klemme <bob.news / gmx.net>: >> >> Dirk Meijer wrote: >>> i started out with your suggestion, but i need it to first display >>> files and dirs in current directory, then do the same for the >>> subdirectories.. >>> ruby -r find -e 'Find.find(".") {|f| puts f}' >>> prints everything at once, which wouldn't work in this case, as i >>> want it to export to different html files (one for each directory) >>> but i need to get this to work first.. >>> greetings, Dirk. >> >> Then you're likely better off using a combination of Find.find and >> Dir like this: >> >> ruby -r find -e 'Find.find(".") {|f| if File.directory? f then puts >> f; p Dir[File.join(f,"*")] end}' >> >> robert >> >>> >>> >>> 2005/11/7, Robert Klemme <bob.news / gmx.net>: >>>> >>>> Dirk Meijer wrote: >>>>> i am using Find::find, but i got it to only display files and dirs >>>>> in current directory, not to do the same with subdirectories.. >>>>> greetings, Dirk. >>>> >>>> Did you try my one liner? Are there sub directories? You're >>>> probably trying to implement the recursion yourself - you must not >>>> do that because that's all Find.find is about... >>>> >>>> Kind regards >>>> >>>> robert >>>> >>>>> >>>>> 2005/11/7, Robert Klemme <bob.news / gmx.net>: >>>>>> >>>>>> Dirk Meijer wrote: >>>>>>> hi, >>>>>>> i want my program to print all files and directories in a given >>>>>>> directory, then print files and dirs in subdirectories, without >>>>>>> it showing the name of the subdirectory.. >>>>>>> but for some reason, it doesn't execute the method again for the >>>>>>> subdirectories found in the current directory.. >>>>>>> greetings, Dirk. >>>>>> >>>>>> You probably get an endless recursion because you don't exclude >>>>>> "." and ".." from the recursion. >>>>>> >>>>>> You can make your life much easier by using Find. Try this: >>>>>> >>>>>> ruby -r find -e 'Find.find(".") {|f| puts f}' >>>>>> >>>>>> Kind regards >>>>>> >>>>>> robert