Folder structure browser, lists folders and files. Provides an Object interface for Common directory related tasks.
__construct( string $path false , boolean $create false , string|boolean $mode false )
Constructor.
$path optional false $create optional false $mode optional false _findRecursive( string $pattern , boolean $sort false )
Private helper function for findRecursive.
$pattern $sort optional false arrayaddPathElement( string $path , string|array $element )
Returns $path with $element added, with correct slash in-between.
$path $element stringcd( string $path )
Change directory to $path.
$path stringchmod( string $path , integer $mode false , boolean $recursive true , array $exceptions array() )
Change the mode on a directory structure recursively. This includes changing the mode on files as well.
$path $mode optional false $recursive optional true $exceptions optional array() booleancopy( array|string $options )
Recursive directory copy.
to The directory to copy to.from The directory to copy from, this will cause a cd() to occur, changing the results of pwd().mode The mode to copy the files/directories with as integer, e.g. 0775.skip Files/directories to skip.scheme Folder::MERGE, Folder::OVERWRITE, Folder::SKIP$options booleancorrectSlashFor( string $path )
Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
$path stringcreate( string $pathname , integer $mode false )
Create a directory structure recursively.
Can be used to create deep path structures like /foo/bar/baz/shoe/horn
$pathname $mode optional false booleandelete( string $path null )
Recursively Remove directories if the system allows.
$path optional null booleandirsize( )
Returns the size in bytes of this Folder and its contents.
integererrors( boolean $reset true )
get error from latest method
$reset optional true arrayfind( string $regexpPattern '.*' , boolean $sort false )
Returns an array of all matching files in current directory.
$regexpPattern optional '.*' $sort optional false arrayfindRecursive( string $pattern '.*' , boolean $sort false )
Returns an array of all matching files in and below current directory.
$pattern optional '.*' $sort optional false arrayinCakePath( string $path '' )
Returns true if the File is in a given CakePath.
$path optional '' booleaninPath( string $path '' , boolean $reverse false )
Returns true if the File is in given path.
$path optional '' $reverse optional false booleanisAbsolute( string $path )
Returns true if given $path is an absolute path.
$path booleanisRegisteredStreamWrapper( string $path )
Returns true if given $path is a registered stream wrapper.
$path booisSlashTerm( string $path )
Returns true if given $path ends in a slash (i.e. is slash-terminated).
$path booleanisWindowsPath( string $path )
Returns true if given $path is a Windows path.
$path booleanmessages( boolean $reset true )
get messages from latest method
$reset optional true arraymove( array $options )
Recursive directory move.
to The directory to copy to.from The directory to copy from, this will cause a cd() to occur, changing the results of pwd().chmod The mode to copy the files/directories with.skip Files/directories to skip.scheme Folder::MERGE, Folder::OVERWRITE, Folder::SKIP$options booleannormalizePath( string $path )
Returns a correct set of slashes for given $path. (\\ for Windows paths and / for other paths.)
$path stringpwd( )
Return current path.
stringread( boolean $sort true , array|boolean $exceptions false , boolean $fullPath false )
Returns an array of the contents of the current directory. The returned array holds two arrays: One of directories and one of files.
$sort optional true $exceptions optional false $fullPath optional false mixedrealpath( string $path )
Get the real path (taking ".." and such into account)
$path stringslashTerm( string $path )
Returns $path with added terminating slash (corrected for Windows or other OS).
$path stringtree( string $path null , array|boolean $exceptions false , string $type null )
Returns an array of nested directories and files in each directory
$path optional null $exceptions optional false $type optional null mixedstring | MERGE Default scheme for Folder::copy Recursively merges subfolders with the same name | 'merge' |
string | OVERWRITE Overwrite scheme for Folder::copy subfolders with the same name will be replaced | 'overwrite' |
string | SKIP Skip scheme for Folder::copy if a subfolder with the same name exists it will be skipped | 'skip' |
© 2005–2016 The Cake Software Foundation, Inc.
Licensed under the MIT License.
CakePHP is a registered trademark of Cake Software Foundation, Inc.
We are not endorsed by or affiliated with CakePHP.
http://api.cakephp.org/2.7/class-Folder.html