> 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

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

v2count.rb:6:in `size': No such file or directory - /etc/fstab 
(Errno::ENOENT)
        from v2count.rb:6
        from v2count.rb:5:in `each_line'
        from v2count.rb:5



Thanks

-Jon
-- 
Posted via http://www.ruby-forum.com/.