From: 7stud -- Date: 2008-04-28T05:15:38+09:00 Subject: Re: Getting Mac file paths from disk... Vincent Angeloni wrote: > Hi, > > As part of my "training" with Ruby, I decided to try and get a list > of files, then save based on size to a new folder for burning onto > CD. When I do this using "Find", I can get the files but if there > are any bundles or packages in the folder, those are being treated > like ordinary folders and Find is burrowing down into the package > contents. This behavior I do not want. > > Here is the code I am using (borrowed from a book): > > require "find" def findfiles(dir, name) > list = [] Find.find(dir) do |path| > Find.prune if [".",".."].include? path case name > when String > list << path if File.basename(path) == name > when Regexp > list << path if File.basename(path) =~ name > else > raise ArgumentError > end > end list > end > Do you expect anyone to be able to read that code? > So when this finds a Numbers file, the result it gives is: > What's a Numbers file? -- Posted via http://www.ruby-forum.com/.