On Tue, Aug 14, 2007 at 04:10:18AM +0900, Jon Hawkins wrote:
> 
> > like:
> > 
> >     find /some/path -type f | ruby program.rb
> > 
> > and have ruby calculate sizes on your files and output summary
> > information?
> > 
> > If that is the case then the file names appear on stdin of the ruby
> > program and you can do:
> > 
> >     $stdin.each_line do |file_path|
> >         res << File.size(file_path)
> >     end
> > 
> > Is that what you are looking for?
> > 
> > enjoy,
> > 
> > -jeremy

My mistake, file_path contains the "\n" 

> #!/usr/bin/ruby
> require 'find'
> Dir.chdir("/")
> res = []
> $stdin.each_line do |file_path|
>   res << File.size(file_path)

    res << File.size(file_path.strip)

> end
> puts "Total Number of Files: #{res.length}"
> 
> #####
> after trying the find /etc/ -type f | ruby program.rb
> i get the following error that i cant seem to figure out


% find /etc/ -type f 2> /dev/null | ruby jon-h.rb
Total Number of Files: 232

enjoy,

-jeremy

-- 
========================================================================
 Jeremy Hinegardner                              jeremy / hinegardner.org