File::removeDirectory
Remove a directory with all its contents
Description
public bool File::removeDirectory( string $directory )
Deletes every file and subdirectory under $directory recursively, then removes $directory itself.
Symbolic links are never followed: a link inside the directory is removed as a link and what it points to is left alone. When $directory itself is a link, only the link is removed.
Returns false when $directory is not a directory or something could not be removed.
Arguments
| Name | Data type | Default | Remarks |
|---|---|---|---|
| $directory | string | Directory to remove |
Example
Controller
use Fegg\Tool\File;
$file = new File();
$file->removeDirectory($this->config['upload_dir']['path'] . '/image/' . $id . '/');