From: "Suraj N. Kurapati" Date: 2006-08-04T15:54:23+09:00 Subject: Re: Dir.glob finding folders -----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Geoff wrote: > I want to prompt to get the letter of the drive to search, > then if the directory has the text "CFI-" in it, add that full path as > a line to a text file. $ ri Find - ------------------------------------------------------------ Class: Find 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 - ------------------------------------------------------------------------ Instance methods: find, prune -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQFE0u7ZmV9O7RYnKMcRAjIBAJ9+q41R2tvLhDGfjFNhHgNBVUGmqgCePUpM UwoV4jQdlEZSTk+A6UZO/HE= =hWcm -----END PGP SIGNATURE-----