gf1987 Posted September 29, 2010 Share Posted September 29, 2010 Hello everyone. I am having trouble trying to write some script that will unlink all files in a directory. Can anyone help me? I am not sure of the best way to do this? Thankyou. Link to comment https://forums.phpfreaks.com/topic/214743-unlink-all-files-in-a-directory/ Share on other sites More sharing options...
AbraCadaver Posted September 29, 2010 Share Posted September 29, 2010 Something like: foreach(glob('/dir/*') as $file) { if(is_file($file)) { unlink($file); }} Link to comment https://forums.phpfreaks.com/topic/214743-unlink-all-files-in-a-directory/#findComment-1117274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.