How to check if certain group of files of similar format exist in PHP? -


i wonder there possible ways check if group of files exit format as: $filename=$anything_id."_".random.".jpg"; random can any. have lots of files like

gb_23232.jpg, gb_23122.jpg, gb_23332.jpg, gb_23422.jpg, gb_23732.jpg, gb_23922.jpg , on.

i want delete files starts gb_

you can use these code

$mask = 'gb_*.*'; array_map('unlink', glob($mask)); 

another code

foreach (glob("gb_*.*") $filename) {     unlink($filename); } 

Comments

Popular posts from this blog

html5 - What is breaking my page when printing? -

html - Unable to style the color of bullets in a list -

c# - must be a non-abstract type with a public parameterless constructor in redis -