Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete files with wildcard in Laravel

Is there a way which allows you to delete files with a wildcard in Laravel 5.2.

For example:

File::delete('foo/bar.*');
like image 491
Dees Oomens Avatar asked Jun 29 '16 07:06

Dees Oomens


1 Answers

I asked the question too quickly. When reading the PHPDoc for File::delete(), i saw you can give an array with paths as parameter.

So this did the trick for me:

File::delete(File::glob('foor/bar.*'));
like image 91
Dees Oomens Avatar answered Nov 18 '22 09:11

Dees Oomens