Folder

A Folder handling class

abstract
since

1.0

Methods

_items

Function to read the files/folders in a folder.

_items(string $path, string $filter, mixed $recurse, boolean $full, array $exclude, string $excludeFilterString, boolean $findfiles) : array
static
since

1.0

Arguments

$path

stringThe path of the folder to read.

$filter

stringA filter for file names.

$recurse

mixedTrue to recursively search into sub-folders, or an integer to specify the maximum depth.

$full

booleanTrue to return the full path to the file.

$exclude

arrayArray with names of files which should not be shown in the result.

$excludeFilterString

stringRegexp of files to exclude

$findfiles

booleanTrue to read the files, false to read the folders

Response

arrayFiles.

copy

Copy a folder.

copy(string $src, string $dest, string $path = '', boolean $force = false, boolean $useStreams = false) : boolean
static
since

1.0

throws

\Joomla\Filesystem\Exception\FilesystemException

Arguments

$src

stringThe path to the source folder.

$dest

stringThe path to the destination folder.

$path

stringAn optional base path to prefix to the file names.

$force

booleanForce copy.

$useStreams

booleanOptionally force folder/file overwrites.

Response

booleanTrue on success.

create

Create a folder -- and all necessary parent folders.

create(string $path = '', integer $mode = 493) : boolean
static
since

1.0

throws

\Joomla\Filesystem\Exception\FilesystemException

Arguments

$path

stringA path to create from the base path.

$mode

integerDirectory permissions to set for folders created. 0755 by default.

Response

booleanTrue if successful.

delete

Delete a folder.

delete(string $path) : boolean
static
since

1.0

throws

\Joomla\Filesystem\Exception\FilesystemException

\UnexpectedValueException

Arguments

$path

stringThe path to the folder to delete.

Response

booleanTrue on success.

files

Utility function to read the files in a folder.

files(string $path, string $filter = '.', mixed $recurse = false, boolean $full = false, array $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array $excludeFilter = array('^\..*', '.*~')) : array
static
since

1.0

throws

\UnexpectedValueException

Arguments

$path

stringThe path of the folder to read.

$filter

stringA filter for file names.

$recurse

mixedTrue to recursively search into sub-folders, or an integer to specify the maximum depth.

$full

booleanTrue to return the full path to the file.

$exclude

arrayArray with names of files which should not be shown in the result.

$excludeFilter

arrayArray of filter to exclude

Response

arrayFiles in the given folder.

folders

Utility function to read the folders in a folder.

folders(string $path, string $filter = '.', mixed $recurse = false, boolean $full = false, array $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array $excludeFilter = array('^\..*')) : array
static
since

1.0

throws

\UnexpectedValueException

Arguments

$path

stringThe path of the folder to read.

$filter

stringA filter for folder names.

$recurse

mixedTrue to recursively search into sub-folders, or an integer to specify the maximum depth.

$full

booleanTrue to return the full path to the folders.

$exclude

arrayArray with names of folders which should not be shown in the result.

$excludeFilter

arrayArray with regular expressions matching folders which should not be shown in the result.

Response

arrayFolders in the given folder.

listFolderTree

Lists folder in format suitable for tree display.

listFolderTree(string $path, string $filter, integer $maxLevel = 3, integer $level, integer $parent) : array
static
since

1.0

Arguments

$path

stringThe path of the folder to read.

$filter

stringA filter for folder names.

$maxLevel

integerThe maximum number of levels to recursively read, defaults to three.

$level

integerThe current level, optional.

$parent

integerUnique identifier of the parent folder, if any.

Response

arrayFolders in the given folder.

makeSafe

Makes path name safe to use.

makeSafe(string $path) : string
static
since

1.0

Arguments

$path

stringThe full path to sanitise.

Response

stringThe sanitised string.

move

Moves a folder.

move(string $src, string $dest, string $path = '', boolean $useStreams = false) : mixed
static
since

1.0

Arguments

$src

stringThe path to the source folder.

$dest

stringThe path to the destination folder.

$path

stringAn optional base path to prefix to the file names.

$useStreams

booleanOptionally use streams.

Response

mixedError message on false or boolean true on success.