# \cge_dir

A simple class for utilities related to manipulating directories.

and searching. and to include builtin caching

## Summary

Methods
Properties
Constants
recursive_rmdir()
recursive_remove_directory()
dir_list()
file_list_regexp()
mkdirr()
get_file_list()
file_matches_pattern()
recursive_glob()
No public properties found
No constants found
No protected methods found
No protected properties found
N/A
No private methods found
No private properties found
N/A
final

File
  lib/class.cge_dir.php
Package
  \CGExtensions
Class hierarchy
  \cge_dir

## Tags

todo |

## Methods

### recursive_rmdir()

    recursive_rmdir(string $directory)

Recursively remove a directory an alias for recursive_remove_directory

#### Parameters

string | $directory | The absolute path to the directory to be removed.

#

static

## Tags

todo |

### recursive_remove_directory()

    recursive_remove_directory(string $directory)

Recursively remove a directory

#### Parameters

string | $directory | The absolute path to the directory to be removed.

#

static

## Tags

todo |

### dir_list()

    dir_list(string $parent) : mixed

Return a list of all of the directories inside a parent This method is NOT recursive

#### Parameters

string | $parent | The absolute path to the directory to search

#### Returns

mixed —

An array of directories directly below the parent, or false.

#

static

## Tags

todo |

### file_list_regexp()

    file_list_regexp(string $dir, string $regexp, int $limit)

A function to return a list of all files in a directory that match a regular expression.

This method is not recursive.

#### Parameters

string | $dir | The absolute path to the directory to search
string | $regexp | The regular expression
int | $limit | The maximum number of results to return.

#

static

#### Deprecated

## Tags

todo |

### mkdirr()

    mkdirr(string $pathname, int $mode) : bool

Recursively create a subdirectory till the path exists

#### Parameters

string | $pathname | The path name to create
int | $mode | The octal permission for the newly created subdirectories

#### Returns

bool

#

static

#### Deprecated

## Tags

todo |

### get_file_list()

    get_file_list(string $dir, string $extensions, bool $sorted) : string[]

Given a directlry, and a list of extensions, return a list of matching files.

This method will not return any directories. This method is not recursive.

#### Parameters

string | $dir | The search directory
string | $extensions | A comma delimited list of extensions to return
bool | $sorted | Wether the output should be sorted (natural case) or not.

#### Returns

string[]

#

static

## Tags

todo |

### file_matches_pattern()

    file_matches_pattern(string $filename, mixed $pattern, bool $case_sensitive, bool $allow_empty)

Given a filename, test if it matches the specified pattern

#### Parameters

string | $filename | The test filename (string) or an array of strings
mixed | $pattern | An array of string patterns, or a single string.
bool | $case_sensitive | Wether the pattern(s) is/are case sensitive
bool | $allow_empty | Wether or not an empty pattern is allowed (to match anything) (deprecated)

#

static

## Tags

todo |

### recursive_glob()

    recursive_glob(string $path, mixed $pattern, string $mode, mixed $excludepattern, int $maxdepth, int $d)

Similar to the PHP glob method this function will search all files in the directory (and below it) and return all files that match the pattern.

#### Parameters

string | $path | The full path to the input directory
mixed | $pattern | An array of string patterns. Or a single string
string | $mode | Either FILES, DIRS, or FULL. If 'FILES', only files matching the pattern are returned. If 'DIRS' only directories are returned. IF 'FULL', any file or directory matching the pattern is returned.
mixed | $excludepattern | An array of string patterns to exclude. Or a simple string
int | $maxdepth | The maximum dirctory level to search. Default is infinite.
int | $d | Internal

#

static

## Tags

todo |

### class.cge_dir.php