Directory access

Directory manipulation

chdir("pathname");   Change the current working directory.
$cwd = `cd`;   Get the current working directory.
mkdir("pathname", 0);   Create a new directory.
rmdir("pathname");   Deletes an empty directory.

Reading a directory

opendir(DIR, "pathname");   Open pathname for reading. DIR is the directory handle name (the convention is to use all uppercase).
$scalar = readdir(DIR);   Reads the name of the next directory entry. Returns the "undefined" value if there are no more entries.
@array = readdir(DIR);   Reads the entire directory, one name per array element.
rewinddir(DIR);   Sets the current position (for "readdir") to the beginning of the directory.
$position = telldir(DIR);   Returns the current "readdir" position.
seekdir(DIR, $position);   Sets the current position (for "readdir"), using a value returned by "telldir".
closedir(DIR);   Close the directory.