dj-kenpo Posted August 7, 2007 Share Posted August 7, 2007 is it possible to delete a file and use an asterix? (or any wildcard) ie, I tried @unlink(Username_CV_."*"); and @unlink(Username_CV_.*); to no success. the ending is a date, so it could be Username_CV_june27_2007 or aug31 or whatever, and obviously I don't want to delete ALL the files from other users as well... I guess I could store the file name in a table, but it would be nicer to not need that to simply delete simple a file... thanks! Link to comment https://forums.phpfreaks.com/topic/63747-solved-unlink-delete-files-with-asterixs-possible/ Share on other sites More sharing options...
trq Posted August 7, 2007 Share Posted August 7, 2007 <?php $files = glob('Username_CV_*'); foreach($files as $file) { unlink($file); } ?> Link to comment https://forums.phpfreaks.com/topic/63747-solved-unlink-delete-files-with-asterixs-possible/#findComment-317688 Share on other sites More sharing options...
dj-kenpo Posted August 7, 2007 Author Share Posted August 7, 2007 coolio, didn't know about glob.. and I wouldn't have known how to find it either, "glob? ya, I had one of those under my bed last week. nasty monsters, never had one in the closet though..." Link to comment https://forums.phpfreaks.com/topic/63747-solved-unlink-delete-files-with-asterixs-possible/#findComment-317696 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.