module DirTravel

{DirTravel} is a library for getting information about files and directories recursively to a tree structure. This library extends the RubyTree classes to include directory and files info. Please refer to RubyTree documentation for RubyTree related features.

A proxy object {DirTravel::Travel} is used to gather the directory content. The “filetree” class method provides interface for getting the content with few options (see: {DirTravel::Travel.filetree} for details).

See the {DirTravel::Entry} methods doc for possibilities in examining the directory hierachy.

Examples:

require 'dirtravel'

# Collect all entries under '.'
d = DirTravel::Travel.filetree( '.' )

# Display names of the entries in the hierarhcy.
d.children.each do |i|
  puts i.name
end

# Display absolute path for file (leaf level) entries.
d.each_leaf do |i|
  puts i.abspath
end

# Get MP3 files and create a list of all album directories.
#   Assume: ".../<album>/<song>" hierarhcy
#
d = DirTravel::Travel.filetree( '.', { :suffix => '.mp3' } )
albums = d.select_level( d.node_height - 1 )

Constants

VERSION

Public Class Methods

version() click to toggle source
# File lib/version.rb, line 3
def DirTravel.version
    DirTravel::VERSION
end