Folder
A Folder handling class
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder instead. |
package |
Joomla CMS |
Methods
_items
Function to read the files/folders in a folder.
_items( path, filter, recurse, full, mixed||string|int exclude, excludeFilterString, findFiles) : mixed||string|int
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::_items() instead. |
Arguments
- path
string
The path of the folder to read.- filter
string
A filter for file names.- recurse
mixed
True to recursively search into sub-folders, or an integer to specify the maximum depth.- full
bool
True to return the full path to the file.- exclude
array<string|int, mixed>
Array with names of files which should not be shown in the result.- excludeFilterString
string
Regexp of files to exclude- findFiles
bool
True to read the files, false to read the folders
Response
array<string|int, mixed>
Files.
copy
Copy a folder.
copy( src, dest, path = '', force = false, useStreams = false) :
since |
1.7.0 |
---|---|
throws |
|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::copy() instead. |
Arguments
- src
string
The path to the source folder.- dest
string
The path to the destination folder.- path
string
An optional base path to prefix to the file names.- force
bool
Force copy.- useStreams
bool
Optionally force folder/file overwrites.
Response
bool
True on success.
create
Create a folder -- and all necessary parent folders.
create( path = '', mode = 0755) :
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::create() instead. The framework class throws Exceptions in case of error which you have to catch. |
Arguments
- path
string
A path to create from the base path.- mode
int
Directory permissions to set for folders created. 0755 by default.
Response
bool
True if successful.
delete
Delete a folder.
delete( path) :
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::delete() instead. The framework class throws Exceptions in case of error which you have to catch. |
Arguments
- path
string
The path to the folder to delete.
Response
bool
True on success.
exists
Wrapper for the standard file_exists function
exists( path) :
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use is_dir() instead. |
Arguments
- path
string
Folder name relative to installation dir
Response
bool
True if path is a folder
files
Utility function to read the files in a folder.
files( path, filter = '.', recurse = false, full = false, mixed||string|int exclude = ['.svn', 'CVS', '.DS_Store', '__MACOSX'], mixed||string|int excludeFilter = ['^\..*', '.*~'], naturalSort = false) : array|bool
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::files() instead. The framework class throws Exceptions in case of error which you have to catch. |
Arguments
- path
string
The path of the folder to read.- filter
string
A filter for file names.- recurse
mixed
True to recursively search into sub-folders, or an integer to specify the maximum depth.- full
bool
True to return the full path to the file.- exclude
array<string|int, mixed>
Array with names of files which should not be shown in the result.- excludeFilter
array<string|int, mixed>
Array of filter to exclude- naturalSort
bool
False for asort, true for natsort
Response
array<string|int, mixed>|bool
Files in the given folder.
folders
Utility function to read the folders in a folder.
folders( path, filter = '.', recurse = false, full = false, mixed||string|int exclude = ['.svn', 'CVS', '.DS_Store', '__MACOSX'], mixed||string|int excludeFilter = ['^\..*']) : mixed||string|int
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::folders() instead. The framework class throws Exceptions in case of error which you have to catch. |
Arguments
- path
string
The path of the folder to read.- filter
string
A filter for folder names.- recurse
mixed
True to recursively search into sub-folders, or an integer to specify the maximum depth.- full
bool
True to return the full path to the folders.- exclude
array<string|int, mixed>
Array with names of folders which should not be shown in the result.- excludeFilter
array<string|int, mixed>
Array with regular expressions matching folders which should not be shown in the result.
Response
array<string|int, mixed>
Folders in the given folder.
listFolderTree
Lists folder in format suitable for tree display.
listFolderTree( path, filter, maxLevel = 3, level, parent) : mixed||string|int
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::listFolderTree() instead. |
Arguments
- path
string
The path of the folder to read.- filter
string
A filter for folder names.- maxLevel
int
The maximum number of levels to recursively read, defaults to three.- level
int
The current level, optional.- parent
int
Unique identifier of the parent folder, if any.
Response
array<string|int, mixed>
Folders in the given folder.
makeSafe
Makes path name safe to use.
makeSafe( path) :
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::makeSafe() instead. |
Arguments
- path
string
The full path to sanitise.
Response
string
The sanitised string.
move
Moves a folder.
move( src, dest, path = '', useStreams = false) :
since |
1.7.0 |
---|---|
deprecated |
4.4 will be removed in 6.0 Use Joomla\Filesystem\Folder::move() instead. The framework class throws Exceptions in case of error which you have to catch. |
Arguments
- src
string
The path to the source folder.- dest
string
The path to the destination folder.- path
string
An optional base path to prefix to the file names.- useStreams
bool
Optionally use streams.
Response
mixed
Error message on false or boolean true on success.