Folder structure browser, lists folders and files. Provides an Object interface for Common directory related tasks.
string
'merge' string
'overwrite' string
'skip' string
'name' string
'time' $_directories protected array$_errors protected array$_files protected array$_fsorts protected array$_messages protected array$mode public integer$path public string$sort public booleanSortedness. Whether or not list results should be sorted by name.
Returns an array of the contents of the current directory. The returned array holds two arrays: One of directories and one of files.
__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 addPathElement( string $path , string|array $element )
Returns $path with $element added, with correct slash in-between.
$path $element cd( string $path )
Change directory to $path.
$path chmod( 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() copy( 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 correctSlashFor( string $path )
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)
$path create( 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 The directory structure to create. Either an absolute or relative path. If the path is relative and exists in the process' cwd it will not be created. Otherwise relative paths will be prefixed with the current pwd().
$mode optional false delete( string $path null )
Recursively Remove directories if the system allows.
$path optional null dirsize( )
Returns the size in bytes of this Folder and its contents.
errors( boolean $reset true )
get error from latest method
$reset optional true find( string $regexpPattern '.*' , boolean $sort false )
Returns an array of all matching files in current directory.
$regexpPattern optional '.*' $sort optional false findRecursive( string $pattern '.*' , boolean $sort false )
Returns an array of all matching files in and below current directory.
$pattern optional '.*' $sort optional false inCakePath( string $path '' )
Returns true if the Folder is in the given Cake path.
$path optional '' inPath( string $path '' , boolean $reverse false )
Returns true if the Folder is in the given path.
$path optional '' pwd() resides within.$reverse optional false $path resides within the current pwd().$path argument is not an absolute path.isAbsolute( string $path )
Returns true if given $path is an absolute path.
$path isRegisteredStreamWrapper( string $path )
Returns true if given $path is a registered stream wrapper.
$path isSlashTerm( string $path )
Returns true if given $path ends in a slash (i.e. is slash-terminated).
$path isWindowsPath( string $path )
Returns true if given $path is a Windows path.
$path messages( boolean $reset true )
get messages from latest method
$reset optional true move( 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 normalizePath( string $path )
Returns a correct set of slashes for given $path. (\ for Windows paths and / for other paths.)
$path pwd( )
Return current path.
read( string|boolean $sort self::SORT_NAME , 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 self::SORT_NAME Whether you want the results sorted, set this and the sort property to false to get unsorted results.
$exceptions optional false $fullPath optional false realpath( string $path )
Get the real path (taking ".." and such into account)
$path slashTerm( string $path )
Returns $path with added terminating slash (corrected for Windows or other OS).
$path tree( 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 Either an array of files/folder to exclude or boolean true to not grab dot files/folders
$type optional null protected array
Functions array to be called depending on the sort type chosen.
array(
self::SORT_NAME => 'getPathname',
self::SORT_TIME => 'getCTime'
) public string
Path to Folder.
null
public boolean
Sortedness. Whether or not list results should be sorted by name.
false
© 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.
https://api.cakephp.org/2.9/class-Folder.html