From: Li Chen Date: 2006-10-23T06:44:30+09:00 Subject: Re: search file in a directory EB wrote: > > Yup, I was looking for something similar, a simple way > to get the functionality of the unix "find" command. > > I was motivated by the slow search facility under XP. Not > sure if ruby might be faster, but it made me curious how > I would specify a file to be found in a directory tree. > > As a newbie I am still not quite familiar with all of the > facilities or libraries, maybe it's obvious :-) > > eb Hi EB, I think Robert kindly provies a pretty neat script which is what I want. I am not sure if you also need a similar one like this, which searches a directory and all children directory for the file specified. Li ### require 'find' path='I:/Common/xxx/Notebooks/Flow/OT1/OTI-4' file_number = 0 Find.find(path) do |f| puts f if File.file?(f) && f=~/\.\d+$/ # print out the file with format xxx.001 xxx.002... file__number+=1 end puts file_number -- Posted via http://www.ruby-forum.com/.