File::removeFile
Remove files
Description
public bool File::removeFile( string $file )
Deletes the file $file. When there is no file of that exact name, $file is used as a glob() pattern (*, ?, [...]) and every matching file is deleted, so a file whose name contains [ or * is removed itself, not the files the pattern would match. Directories are not removed.
Returns false when a file could not be removed. A pattern that matches nothing returns true.
Arguments
| Name | Data type | Default | Remarks |
|---|---|---|---|
| $file | string | File path or glob() pattern |
Example
Controller
use Fegg\Tool\File;
$file = new File();
$file->removeFile('path/to/foo.txt');
// Remove all the log files
$file->removeFile('path/to/log/*.log');