Changes the current working directory of the process to the given string.
When called without an argument, changes the directory to the value of the
environment variable HOME, or LOGDIR.
SystemCallError (probably Errno::ENOENT) if the
target directory does not exist.

If a block is given, it is passed the name of the new current directory,
and the block is executed with that as the current directory. The original
working directory is restored when the block exits. The return value of
chdir is the value of the block. chdir blocks can
be nested, but in a multi-threaded program an error will be raised if a
thread attempts to open a chdir block while another thread has
one open.

Returns the path to the current working directory of this process as a
string.

Dir.chdir("/tmp") #=> 0Dir.getwd#=> "/tmp"Dir.pwd#=> "/tmp"

static VALUE
dir_s_getwd(VALUE dir)
{
return rb_dir_getwd();
}

glob( pattern, [flags] ) → matchesclick to toggle source

glob( pattern, [flags] ) { |filename| block } → nil

Expands pattern, which is an Array of
patterns or a pattern String, and returns the
results as matches or as arguments given 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), as does the order in which
the results are returned.

*

Matches any file. Can be restricted by other values in the glob. Equivalent
to / .* /x in regexp.

*

Matches all files

c*

Matches all files beginning with c

*c

Matches all files ending with c

*c*

Match all files that have c in them (including at the
beginning or end).

Note, this will not match Unix-like hidden files (dotfiles). In order to
include those in the match results, you must use the File::FNM_DOTMATCH
flag or something like "{*,.*}".

**

Matches directories recursively.

?

Matches any one character. Equivalent to /.{1}/ in regexp.

[set]

Matches any one character in set. Behaves exactly like
character sets in Regexp, including set negation
([^a-z]).

{p,q}

Matches either literal p or literal q. Equivalent
to pattern alternation in regexp.

Matching literals may be more than one character in length. More than two
literals may be specified.

\

Escapes the next metacharacter.

Note that this means you cannot use backslash on windows as part of a glob,
i.e. Dir["c:\foo*"] will not work, use
Dir["c:/foo*"] instead.

Makes a new directory named by string, with permissions specified
by the optional parameter anInteger. The permissions may be
modified by the value of File::umask, and are ignored on NT.
Raises a SystemCallError if the directory cannot be created.
See also the discussion of permissions in the class documentation for
File.