Inheritance diagram for Folder:

Public Member Functions | |
| __construct ($path=false, $create=false, $mode=false) | |
| __tree ($path, $exceptions) | |
| _findRecursive ($pattern, $sort=false) | |
| cd ($path) | |
| chmod ($path, $mode=false, $recursive=true, $exceptions=array()) | |
| copy ($options=array()) | |
| cp ($options) | |
| create ($pathname, $mode=false) | |
| delete ($path=null) | |
| dirsize () | |
| errors () | |
| find ($regexpPattern= '.*', $sort=false) | |
| findRecursive ($pattern= '.*', $sort=false) | |
| inCakePath ($path= '') | |
| inPath ($path= '', $reverse=false) | |
| ls ($sort=true, $exceptions=false) | |
| messages () | |
| mkdir ($pathname, $mode=0755) | |
| move ($options) | |
| mv ($options) | |
| pwd () | |
| read ($sort=true, $exceptions=false, $fullPath=false) | |
| realpath ($path) | |
| rm ($path) | |
| tree ($path, $exceptions=true, $type=null) | |
Static Public Member Functions | |
| addPathElement ($path, $element) | |
| correctSlashFor ($path) | |
| isAbsolute ($path) | |
| isSlashTerm ($path) | |
| isWindowsPath ($path) | |
| normalizePath ($path) | |
| slashTerm ($path) | |
Public Attributes | |
| $__directories | |
| $__errors = false | |
| $__files | |
| $__messages = array() | |
| $mode = 0755 | |
| $path = null | |
| $sort = false | |
Definition at line 40 of file folder.php.
Constructor.
| string | $path Path to folder | |
| boolean | $create Create folder if not found | |
| mixed | $mode Mode (CHMOD) to apply to created folder, false to ignore |
Definition at line 97 of file folder.php.
References $mode, $path, __construct(), cd(), create(), isAbsolute(), and realpath().
| Folder::__tree | ( | $ | path, | |
| $ | exceptions | |||
| ) |
| Folder::_findRecursive | ( | $ | pattern, | |
| $ | sort = false | |||
| ) |
Private helper function for findRecursive.
| string | $pattern Pattern to match against |
Definition at line 213 of file folder.php.
References $sort, addPathElement(), cd(), findRecursive(), and read().
Referenced by findRecursive().
| Folder::addPathElement | ( | $ | path, | |
| $ | element | |||
| ) | [static] |
Returns $path with $element added, with correct slash in-between.
| string | $path Path | |
| string | $element Element to and at end of path |
Definition at line 304 of file folder.php.
References $path, and slashTerm().
Referenced by _findRecursive(), copy(), read(), and realpath().
| Folder::cd | ( | $ | path | ) |
Change directory to $path.
| string | $path Path to the directory to change to |
Definition at line 132 of file folder.php.
References $path, and realpath().
Referenced by __construct(), __tree(), _findRecursive(), copy(), findRecursive(), move(), and tree().
| Folder::chmod | ( | $ | path, | |
| $ | mode = false, |
|||
| $ | recursive = true, |
|||
| $ | exceptions = array() | |||
| ) |
Change the mode on a directory structure recursively. This includes changing the mode on files as well.
| string | $path The path to chmod | |
| integer | $mode octal value 0755 | |
| boolean | $recursive chmod recursively | |
| array | $exceptions array of files, directories to skip |
Definition at line 350 of file folder.php.
References $mode, $path, __(), and tree().
Referenced by copy().
| Folder::copy | ( | $ | options = array() |
) |
Recursive directory copy.
| array | $options (to, from, chmod, skip) |
Definition at line 568 of file folder.php.
References $handle, $mode, __(), addPathElement(), cd(), chmod(), mkdir(), and writable().
| Folder::correctSlashFor | ( | $ | path | ) | [static] |
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)
| string | $path Path to check |
Definition at line 275 of file folder.php.
References $path, and isWindowsPath().
Referenced by normalizePath(), and slashTerm().
| Folder::cp | ( | $ | options | ) |
nix flavored alias
Definition at line 700 of file folder.php.
References copy().
| Folder::create | ( | $ | pathname, | |
| $ | mode = false | |||
| ) |
Create a directory structure recursively.
| string | $pathname The directory structure to create | |
| integer | $mode octal value 0755 |
Definition at line 448 of file folder.php.
References $mode, __(), a(), and mkdir().
Referenced by __construct(), and mkdir().
| Folder::delete | ( | $ | path = null |
) |
Recursively Remove directories if system allow.
| string | $path Path of directory to delete |
Definition at line 522 of file folder.php.
References $path, __(), pwd(), and slashTerm().
| Folder::dirsize | ( | ) |
Returns the size in bytes of this Folder.
| string | $directory Path to directory |
Definition at line 486 of file folder.php.
References read(), and slashTerm().
| Folder::errors | ( | ) |
| Folder::find | ( | $ | regexpPattern = '.*', |
|
| $ | sort = false | |||
| ) |
Returns an array of all matching files in current directory.
| string | $pattern Preg_match pattern (Defaults to: .*) |
Definition at line 189 of file folder.php.
| Folder::findRecursive | ( | $ | pattern = '.*', |
|
| $ | sort = false | |||
| ) |
Returns an array of all matching files in and below current directory.
| string | $pattern Preg_match pattern (Defaults to: .*) |
Definition at line 200 of file folder.php.
References $out, $sort, _findRecursive(), and cd().
Referenced by _findRecursive().
| Folder::inCakePath | ( | $ | path = '' |
) |
Returns true if the File is in a given CakePath.
Definition at line 313 of file folder.php.
References $path, inPath(), and slashTerm().
| Folder::inPath | ( | $ | path = '', |
|
| $ | reverse = false | |||
| ) |
Returns true if the File is in given path.
Definition at line 325 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.
| string | $path Path to check |
Definition at line 252 of file folder.php.
Referenced by __construct(), and realpath().
| Folder::isSlashTerm | ( | $ | path | ) | [static] |
Returns true if given $path ends in a slash (i.e. is slash-terminated).
| string | $path Path to check |
Definition at line 768 of file folder.php.
References $path.
Referenced by slashTerm().
| Folder::isWindowsPath | ( | $ | path | ) | [static] |
Returns true if given $path is a Windows path.
| string | $path Path to check |
Definition at line 238 of file folder.php.
References $path.
Referenced by correctSlashFor().
| Folder::ls | ( | $ | sort = true, |
|
| $ | exceptions = false | |||
| ) |
| Folder::messages | ( | ) |
| Folder::mkdir | ( | $ | pathname, | |
| $ | mode = 0755 | |||
| ) |
| Folder::move | ( | $ | options | ) |
Recursive directory move.
| array | $options (to, from, chmod, skip) |
Definition at line 643 of file folder.php.
Referenced by mv().
| Folder::mv | ( | $ | options | ) |
nix flavored alias
Definition at line 709 of file folder.php.
References move().
| Folder::normalizePath | ( | $ | path | ) | [static] |
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)
| string | $path Path to check |
Definition at line 264 of file folder.php.
References $path, and correctSlashFor().
| Folder::pwd | ( | ) |
Returns an array of the contents of the current directory. The returned array holds two arrays: One of directories and one of files.
| boolean | $sort | |
| mixed | $exceptions Either an array or boolean true will not grab dot files | |
| boolean | $fullPath True returns the full path |
Definition at line 149 of file folder.php.
References $path, $sort, and addPathElement().
Referenced by __tree(), _findRecursive(), dirsize(), find(), and ls().
| Folder::realpath | ( | $ | path | ) |
Get the real path (taking ".." and such into account)
| string | $path Path to resolve |
Definition at line 727 of file folder.php.
References $path, addPathElement(), isAbsolute(), and slashTerm().
Referenced by __construct(), and cd().
| Folder::rm | ( | $ | path | ) |
nix flavored alias
Definition at line 718 of file folder.php.
References $path.
| Folder::slashTerm | ( | $ | path | ) | [static] |
Returns $path with added terminating slash (corrected for Windows or other OS).
| string | $path Path to check |
Definition at line 289 of file folder.php.
References $path, correctSlashFor(), and isSlashTerm().
Referenced by addPathElement(), delete(), dirsize(), ProjectTask::execute(), inCakePath(), inPath(), and realpath().
| Folder::tree | ( | $ | path, | |
| $ | exceptions = true, |
|||
| $ | type = null | |||
| ) |
Returns an array of nested directories and files in each directory
| string | $path the directory path to build the tree from | |
| boolean | $hidden return hidden files and directories | |
| string | $type either file or dir. null returns both files and directories |
Definition at line 400 of file folder.php.
References $path, __tree(), and cd().
Referenced by chmod().
| Folder::$__directories |
Definition at line 82 of file folder.php.
| Folder::$__errors = false |
Definition at line 75 of file folder.php.
| Folder::$__files |
Definition at line 89 of file folder.php.
| Folder::$__messages = array() |
Definition at line 68 of file folder.php.
| Folder::$mode = 0755 |
Definition at line 61 of file folder.php.
Referenced by __construct(), chmod(), copy(), create(), and mkdir().
| Folder::$path = null |
Definition at line 47 of file folder.php.
Referenced by __construct(), __tree(), addPathElement(), cd(), chmod(), correctSlashFor(), delete(), inCakePath(), inPath(), isSlashTerm(), isWindowsPath(), normalizePath(), read(), realpath(), rm(), slashTerm(), and tree().
| Folder::$sort = false |
Definition at line 54 of file folder.php.
Referenced by _findRecursive(), find(), findRecursive(), ls(), and read().
1.4.7