public static
boolean
|
#
copy( string $src, string $dest, string $path = '', boolean $force = false, boolean $use_streams = false )
Copy a folder.
Parameters
- $src
string - $src The path to the source folder.
- $dest
string - $dest The path to the destination folder.
- $path
string - $path An optional base path to prefix to the file names.
- $force
boolean - $force Force copy.
- $use_streams
boolean - $use_streams Optionally force folder/file overwrites.
Returns
boolean - True on success.
Throws
Since
11.1
|
public static
boolean
|
#
create( string $path = '', integer $mode = 0755 )
Create a folder -- and all necessary parent folders.
Create a folder -- and all necessary parent folders.
Parameters
- $path
string - $path A path to create from the base path.
- $mode
integer - $mode Directory permissions to set for folders created. 0755 by default.
Returns
boolean - True if successful.
Since
11.1
|
public static
boolean
|
#
delete( string $path )
Delete a folder.
Parameters
- $path
string - $path The path to the folder to delete.
Returns
boolean - True on success.
Since
11.1
|
public static
mixed
|
#
move( string $src, string $dest, string $path = '', boolean $use_streams = false )
Moves a folder.
Parameters
- $src
string - $src The path to the source folder.
- $dest
string - $dest The path to the destination folder.
- $path
string - $path An optional base path to prefix to the file names.
- $use_streams
boolean - $use_streams Optionally use streams.
Returns
mixed - Error message on false or boolean true on success.
Since
11.1
|
public static
boolean
|
#
exists( string $path )
Wrapper for the standard file_exists function
Wrapper for the standard file_exists function
Parameters
- $path
string - $path Folder name relative to installation dir
Returns
boolean - True if path is a folder
Since
11.1
|
public static
array
|
#
files( string $path, string $filter = '.', mixed $recurse = false, boolean $full = false, array $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array $excludefilter = array('^\..*', '.*~'), boolean $naturalSort = false )
Utility function to read the files in a folder.
Utility function to read the files in a folder.
Parameters
- $path
string - $path The path of the folder to read.
- $filter
string - $filter A filter for file names.
- $recurse
mixed - $recurse True to recursively search into sub-folders, or an integer to specify
the maximum depth.
- $full
boolean - $full True to return the full path to the file.
- $exclude
array - $exclude Array with names of files which should not be shown in the result.
- $excludefilter
array - $excludefilter Array of filter to exclude
- $naturalSort
boolean - $naturalSort False for asort, true for natsort
Returns
array - Files in the given folder.
Since
11.1
|
public static
array
|
#
folders( string $path, string $filter = '.', mixed $recurse = false, boolean $full = false, array $exclude = array('.svn', 'CVS', '.DS_Store', '__MACOSX'), array $excludefilter = array('^\..*') )
Utility function to read the folders in a folder.
Utility function to read the folders in a folder.
Parameters
- $path
string - $path The path of the folder to read.
- $filter
string - $filter A filter for folder names.
- $recurse
mixed - $recurse True to recursively search into sub-folders, or an integer to specify
the maximum depth.
- $full
boolean - $full True to return the full path to the folders.
- $exclude
array - $exclude Array with names of folders which should not be shown in the result.
- $excludefilter
array - $excludefilter Array with regular expressions matching folders which should not
be shown in the result.
Returns
array - Folders in the given folder.
Since
11.1
|
protected static
array
|
#
_items( string $path, string $filter, mixed $recurse, boolean $full, array $exclude, string $excludefilter_string, boolean $findfiles )
Function to read the files/folders in a folder.
Function to read the files/folders in a folder.
Parameters
- $path
string - $path The path of the folder to read.
- $filter
string - $filter A filter for file names.
- $recurse
mixed - $recurse True to recursively search into sub-folders, or an integer to specify
the maximum depth.
- $full
boolean - $full True to return the full path to the file.
- $exclude
array - $exclude Array with names of files which should not be shown in the result.
- $excludefilter_string
string - $excludefilter_string Regexp of files to exclude
- $findfiles
boolean - $findfiles True to read the files, false to read the folders
Returns
array - Files.
Since
11.1
|
public static
array
|
#
listFolderTree( string $path, string $filter, integer $maxLevel = 3, integer $level = 0, integer $parent = 0 )
Lists folder in format suitable for tree display.
Lists folder in format suitable for tree display.
Parameters
- $path
string - $path The path of the folder to read.
- $filter
string - $filter A filter for folder names.
- $maxLevel
integer - $maxLevel The maximum number of levels to recursively read, defaults to three.
- $level
integer - $level The current level, optional.
- $parent
integer - $parent Unique identifier of the parent folder, if any.
Returns
array - Folders in the given folder.
Since
11.1
|
public static
string
|
#
makeSafe( string $path )
Makes path name safe to use.
Makes path name safe to use.
Parameters
- $path
string - $path The full path to sanitise.
Returns
string - The sanitised string.
Since
11.1
|