Class | Dir |
In: |
lib/core/facets/dir/ascend.rb
lib/core/facets/dir/multiglob.rb lib/core/facets/dir/parent.rb lib/core/facets/dir/recurse.rb |
Parent: | Object |
Descend a directory path.
Dir.descend("/var/log") do |path| p path end
produces
/ /var /var/log
CREDIT: Daniel Berger, Jeffrey Schwab
Like glob but can take multiple patterns.
Dir.multiglob( '*.rb', '*.py' )
Rather then constants for options multiglob accepts a trailing options hash of symbol keys.
:noescape File::FNM_NOESCAPE :casefold File::FNM_CASEFOLD :pathname File::FNM_PATHNAME :dotmatch File::FNM_DOTMATCH :strict File::FNM_PATHNAME && File::FNM_DOTMATCH
It also has an option for recurse.
:recurse Recurively include contents of directories.
For example
Dir.multiglob( '*', :recurse => true )
would have the same result as
Dir.multiglob('**/*')
The same as multiglob, but recusively includes directories.
Dir.multiglob_r( 'folder' )
is equivalent to
Dir.multiglob( 'folder', :recurse=>true )
The effect of which is
Dir.multiglob( 'folder', 'folder/**/**' )