delete()
accepts an array of files for deletion. Thus, one possible solution is listing the directory with a wildcard selector, then filter out your exclusion list from the array.
$filesForDelete = array_filter(glob("path/to/files/*"), function($file) {
return false === strpos($file, 'placeholder.png');
});
Storage::delete($filesForDelete);
Of course, your filter expression may become better, broader, or just do the same thing in many other ways.
For example, you may create a helper function like this:
function deleteAllButFile($exclude)
{
$filesForDelete = array_filter(glob("path/to/files/*"), function($file) use ($exclude) {
return false === strpos($file, $exclude);
});
Storage::delete($filesForDelete);
}
// Call it like
deleteAllButFile('placeholder.png');
Or any other way you like. Up to your imagination.