Type:
Module

The Find module supports the top-down traversal of a set of file paths.

For example, to total the size of all files under your home directory, ignoring anything in a “dot” directory (e.g. $HOME/.ssh):

require 'find'

total_size = 0

Find.find(ENV["HOME"]) do |path|
  if FileTest.directory?(path)
    if File.basename(path)[0] == ?.
      Find.prune       # Don't look any further into this directory.
    else
      next
    end
  else
    total_size += FileTest.size(path)
  end
end
find

find(*paths) Class Public methods Calls the associated block with the name of

2015-04-06 21:48:09
prune

prune() Class Public methods Skips the current file or directory, restarting

2015-04-06 21:51:55