Folder Class Reference

Inheritance diagram for Folder:

Object

List of all members.


Public Member Functions

 _findRecursive ($pattern)
 cd ($desiredPath)
 dirsize ()
 find ($regexp_pattern= '.*')
 findRecursive ($pattern= '.*')
 inCakePath ($path= '')
 inPath ($path= '')
 ls ($sort=true, $noDotFiles=false)
 mkdirr ($pathname, $mode=null)
 pwd ()

Static Public Member Functions

 addPathElement ($path, $element)
 correctSlashFor ($path)
 isAbsolute ($path)
 isSlashTerm ($path)
 isWindowsPath ($path)
 slashTerm ($path)

Public Attributes

 $path = null
 $sort = false

Detailed Description

Definition at line 42 of file folder.php.


Member Function Documentation

Folder::_findRecursive ( pattern  ) 

Private helper function for findRecursive.

Parameters:
string $pattern
Returns:
array Files matching pattern private

Definition at line 164 of file folder.php.

References $file, addPathElement(), cd(), findRecursive(), and ls().

Referenced by findRecursive().

Folder::addPathElement ( path,
element 
) [static]

Returns $path with $element added, with correct slash in-between.

Parameters:
string $path
string $element
Returns:
string

Definition at line 241 of file folder.php.

References $path, and slashTerm().

Referenced by _findRecursive(), cd(), and ls().

Folder::cd ( desiredPath  ) 

Change directory to $desired_path.

Parameters:
string $desired_path Path to the directory to change to
Returns:
string The new path. Returns false on failure

Definition at line 86 of file folder.php.

References addPathElement(), and isAbsolute().

Referenced by _findRecursive(), and findRecursive().

Folder::correctSlashFor ( path  )  [static]

Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)

Parameters:
string $path Path to check
Returns:
string Set of slashes ("\\" or "/")

Definition at line 220 of file folder.php.

References $path, and isWindowsPath().

Referenced by slashTerm().

Folder::dirsize (  ) 

Returns the size in bytes of this Folder.

Parameters:
string $directory Path to directory

Definition at line 299 of file folder.php.

References slashTerm().

Folder::find ( regexp_pattern = '.*'  ) 

Returns an array of all matching files in current directory.

Parameters:
string $pattern Preg_match pattern (Defaults to: .*)
Returns:
array

Definition at line 128 of file folder.php.

References $data, $file, and ls().

Folder::findRecursive ( pattern = '.*'  ) 

Returns an array of all matching files in and below current directory.

Parameters:
string $pattern Preg_match pattern (Defaults to: .*)
Returns:
array Files matching $pattern

Definition at line 151 of file folder.php.

References _findRecursive(), and cd().

Referenced by _findRecursive().

Folder::inCakePath ( path = ''  ) 

Returns true if the File is in a given CakePath.

Returns:
boolean

Definition at line 249 of file folder.php.

References $path, inPath(), and slashTerm().

Folder::inPath ( path = ''  ) 

Returns true if the File is in given path.

Returns:
boolean

Definition at line 259 of file folder.php.

References $path, pwd(), and slashTerm().

Referenced by inCakePath().

Folder::isAbsolute ( path  )  [static]

Returns true if given $path is an absolute path.

Parameters:
string $path Path to check
Returns:
boolean

Definition at line 198 of file folder.php.

References $path.

Referenced by cd().

Folder::isSlashTerm ( path  )  [static]

Returns true if given $path ends in a slash (i.e. is slash-terminated).

Parameters:
string $path Path to check
Returns:
boolean

Definition at line 209 of file folder.php.

References $path.

Referenced by slashTerm().

Folder::isWindowsPath ( path  )  [static]

Returns true if given $path is a Windows path.

Parameters:
string $path Path to check
Returns:
boolean

Definition at line 187 of file folder.php.

References $path.

Referenced by correctSlashFor().

Folder::ls ( sort = true,
noDotFiles = false 
)

Returns an array of the contents of the current directory, or false on failure. The returned array holds two arrays: one of dirs and one of files.

Parameters:
boolean $sort
boolean $noDotFiles
Returns:
array

Definition at line 100 of file folder.php.

References $sort, and addPathElement().

Referenced by _findRecursive(), and find().

Folder::mkdirr ( pathname,
mode = null 
)

Create a directory structure recursively.

Parameters:
string $pathname The directory structure to create
Returns:
bool Returns TRUE on success, FALSE on failure

Definition at line 274 of file folder.php.

Folder::pwd (  ) 

Return current path.

Returns:
string Current path

Definition at line 77 of file folder.php.

Referenced by inPath().

Folder::slashTerm ( path  )  [static]

Returns $path with added terminating slash (corrected for Windows or other OS).

Parameters:
string $path Path to check
Returns:
string

Definition at line 230 of file folder.php.

References $path, correctSlashFor(), and isSlashTerm().

Referenced by addPathElement(), dirsize(), inCakePath(), and inPath().


Member Data Documentation

Folder::$path = null

Folder::$sort = false

Definition at line 54 of file folder.php.

Referenced by ls().


The documentation for this class was generated from the following file: