shadiadiph Posted May 13, 2009 Share Posted May 13, 2009 I know hoe to remove a file and how to remove a directory but is there an easyway to remove a directory and its contents without having to unlink each file then remove the directory? Link to comment https://forums.phpfreaks.com/topic/158038-does-nayone-know-of-how-to-remove-a-directory-and-its-contents/ Share on other sites More sharing options...
jackpf Posted May 13, 2009 Share Posted May 13, 2009 Use a while() loop to get each file in the directory, and unlink that file in the loop. Then delete the directory. I don't think there's an easier way than that... Link to comment https://forums.phpfreaks.com/topic/158038-does-nayone-know-of-how-to-remove-a-directory-and-its-contents/#findComment-833663 Share on other sites More sharing options...
shadiadiph Posted May 13, 2009 Author Share Posted May 13, 2009 ok thank was just asking if anyone knew if there was a way of just removing it in one go Link to comment https://forums.phpfreaks.com/topic/158038-does-nayone-know-of-how-to-remove-a-directory-and-its-contents/#findComment-833667 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.