Folder

A Folder handling class

abstract
since

1.0

package

Joomla Framework

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
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

boolTrue 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

stringRegexp of files to exclude

findfiles

boolTrue 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) : 
static
since

1.0

throws

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

boolForce copy.

useStreams

boolOptionally force folder/file overwrites.

Response

boolTrue on success.

create

Create a folder -- and all necessary parent folders.

create( path = '',  mode = 0755) : 
static
since

1.0

throws

FilesystemException

Arguments

path

stringA path to create from the base path.

mode

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

Response

boolTrue if successful.

delete

Delete a folder.

delete( path) : 
static
since

1.0

throws

FilesystemException

UnexpectedValueException

Arguments

path

stringThe path to the folder to delete.

Response

boolTrue on success.

exists

Wrapper for the standard is_dir function

exists( path) : 
static

Arguments

path

stringFolder path

Response

boolTrue 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) : mixed||string|int
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

boolTrue 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

boolFalse for asort, true for natsort

Response

array<string|int, mixed>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
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

boolTrue 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
static
since

1.0

Arguments

path

stringThe path of the folder to read.

filter

stringA filter for folder names.

maxLevel

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

level

intThe current level, optional.

parent

intUnique 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) : 
static
since

1.0

Arguments

path

stringThe full path to sanitise.

Response

stringThe sanitised string.

move

Moves a folder.

move( src,  dest,  path = '',  useStreams = false) : string|bool
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

boolOptionally use streams.

Response

string|boolError message on false or boolean true on success.