From: Joel VanderWerf Date: 2010-09-09T12:32:14+09:00 Subject: Re: different in single star(*) and double stars(**)? Zhenning Guan wrote: > # Load any custom rakefile extensions > deprecated_paths = > Dir["#{RAILS_ROOT}/vendor/plugins/*/tasks/**/*.rake"].sort > > the code in rails. and what's the different * and **? There is a brief explanation in the docs for the glob method: $ ri Dir.glob | cat -------------------------------------------------------------- Dir::glob Dir.glob( pattern, [flags] ) => array Dir.glob( pattern, [flags] ) {| filename | block } => nil ------------------------------------------------------------------------ Returns the filenames found by expanding pattern which is an Array of the patterns or the pattern String, either as an array or as parameters to the block. Note that this pattern is not a regexp (it's closer to a shell glob). See File::fnmatch for the meaning of the flags parameter. Note that case sensitivity depends on your system (so File::FNM_CASEFOLD is ignored) *: Matches any file. Can be restricted by other values in the glob. * will match all files; c* will match all files beginning with c; *c will match all files ending with c; and c will match all files that have c in them (including at the beginning or end). Equivalent to / .* /x in regexp. **: Matches directories recursively. (There are also some examples... see if you can run ri to see them.)