Type:
Class

Objects of class Dir are directory streams representing directories in the underlying file system. They provide a variety of ways to list directories and their contents. See also File.

The directory used in these examples contains the two regular files (config.h and main.rb), the parent directory (..), and the directory itself (.).

chroot
  • References/Ruby on Rails/Ruby/Classes/Dir

Dir.chroot( string ) â 0 Class Public methods Changes this process's idea of

2025-01-10 15:47:30
delete
  • References/Ruby on Rails/Ruby/Classes/Dir

Dir.delete( string ) â 0 Class Public methods Deletes the named directory. Raises

2025-01-10 15:47:30
rewind
  • References/Ruby on Rails/Ruby/Classes/Dir

dir.rewind â dir Instance Public methods Repositions dir to the first

2025-01-10 15:47:30
glob
  • References/Ruby on Rails/Ruby/Classes/Dir

Dir.glob( pattern, [flags] ) â arrayDir.glob( pattern, [flags] ) {| filename | block } â nil Class Public

2025-01-10 15:47:30
each
  • References/Ruby on Rails/Ruby/Classes/Dir

dir.each { |filename| block } â dirdir.each â an_enumerator Instance Public methods

2025-01-10 15:47:30
exist?
  • References/Ruby on Rails/Ruby/Classes/Dir

Dir.exist?(file_name) â true or false Class Public methods Returns true

2025-01-10 15:47:30
read
  • References/Ruby on Rails/Ruby/Classes/Dir

dir.read â string or nil Instance Public methods Reads the next entry from

2025-01-10 15:47:30
entries
  • References/Ruby on Rails/Ruby/Classes/Dir

Dir.entries( dirname ) â array Class Public methods Returns an array containing

2025-01-10 15:47:30
open
  • References/Ruby on Rails/Ruby/Classes/Dir

Dir.open( string ) â aDirDir.open( string ) {| aDir | block } â anObject Class Public methods

2025-01-10 15:47:30
rmdir
  • References/Ruby on Rails/Ruby/Classes/Dir

Dir.rmdir( string ) â 0 Class Public methods Deletes the named directory. Raises

2025-01-10 15:47:30