简体   繁体   中英

Delete all files that it's name end with specific string

How to delete all files that it's name end with specific character

example of files that i want to delete

 /images/m/tme-500x500-3092.jpg
 /images/m/tme-200x200-3092.jpg
 /images/m/tme-300x400-3092.jpg

code

 $files = glob($basePath . '/../images/m/"*"3092.jpg');
 foreach ($files as $file) {
       unlink($file);
    }

what should i replace "*" with ?

Are you joking? :-)

Assuming that the path is right.

$files = glob($basePath . '/../images/m/tme-*-3092.jpg');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM