Directory
in package
Directory operations ---- This class provides a set of methods for local directory operations
Tags
Table of Contents
Properties
- $dirCreateOptions : mixed
- $errorsArray : mixed
Methods
- copy() : bool
- Copy a directory
- create() : bool
- Create a new directory
- delete() : bool
- Delete a directory
- dirs() : array<string|int, mixed>|false
- Get all directories in a directory
- errors() : array<string|int, mixed>
- Return all errors that occurred during dir operations
- exists() : bool
- Check if a directory exists
- files() : array<string|int, mixed>|false
- Get all files in a directory
- info() : array<string|int, mixed>|bool
- Get a summary of the dir information
- isEmpty() : bool
- Check if a directory is empty
- move() : bool
- Move a directory to a new location
- read() : array<string|int, mixed>|false
- List all files and folders in a directory
- size() : number
- Get the total size of a directory
Properties
$dirCreateOptions
protected
static mixed
$dirCreateOptions
= ['mode' => 0777, 'rename' => false, 'recursive' => false, 'overwrite' => false]
$errorsArray
protected
static mixed
$errorsArray
= []
Methods
copy()
Copy a directory
public
static copy(string $source, string $destination[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $source : string
-
The path of the dir to copy
- $destination : string
-
The path to copy the dir to
- $options : array<string|int, mixed> = []
-
Options for copying the dir
Return values
boolcreate()
Create a new directory
public
static create(string $dirPath[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $dirPath : string
-
The path of the new directory
- $options : array<string|int, mixed> = []
-
Options for creating the directory
Return values
booldelete()
Delete a directory
public
static delete(string $dirPath[, mixed $options = [] ]) : bool
Parameters
- $dirPath : string
-
The path of the directory to delete
- $options : mixed = []
Return values
booldirs()
Get all directories in a directory
public
static dirs(string $dirPath) : array<string|int, mixed>|false
Parameters
- $dirPath : string
-
The path of the dir to get the directories from
Return values
array<string|int, mixed>|falseerrors()
Return all errors that occurred during dir operations
public
static errors() : array<string|int, mixed>
Return values
array<string|int, mixed>exists()
Check if a directory exists
public
static exists(mixed $filePath) : bool
Parameters
- $filePath : mixed
Return values
boolfiles()
Get all files in a directory
public
static files(string $dirPath) : array<string|int, mixed>|false
Parameters
- $dirPath : string
-
The path of the dir to get the files from
Return values
array<string|int, mixed>|falseinfo()
Get a summary of the dir information
public
static info(string $dirPath) : array<string|int, mixed>|bool
Parameters
- $dirPath : string
-
The path of the dir to get the summary of
Return values
array<string|int, mixed>|boolisEmpty()
Check if a directory is empty
public
static isEmpty(string $dirPath) : bool
Parameters
- $dirPath : string
-
The path of the directory to check
Return values
boolmove()
Move a directory to a new location
public
static move(string $source, string $destination[, array<string|int, mixed> $options = [] ]) : bool
Parameters
- $source : string
-
The path of the dir to move
- $destination : string
-
The path to move the dir to
- $options : array<string|int, mixed> = []
-
Options for moving the dir
Return values
boolread()
List all files and folders in a directory
public
static read(string $dirPath[, string|callable|null $pattern = null ]) : array<string|int, mixed>|false
Parameters
- $dirPath : string
- $pattern : string|callable|null = null
Return values
array<string|int, mixed>|falsesize()
Get the total size of a directory
public
static size(string $dirPath[, string $unit = 'byte' ]) : number
Parameters
- $dirPath : string
-
The path of the directory to get the size of
- $unit : string = 'byte'
-
The unit to return the size in