Warptweet Posted October 1, 2007 Share Posted October 1, 2007 Like most people who use a host to host their website, it's probably stored in public_html. My public_html is so incredibly stacked with useless things, I need a fresh start. I tried deleting it with my FTP program, but my directory public_html is so ridiculously stacked, my internet has a connection glitch before it can even finish expanding the folders and begin deleting files -- and I really don't know what else to do. I guess I could use my favorite coding language PHP to do this for me. How would I delete an entire directory, including all the contents inside that directory, and all directories inside that directory. (public_html) I'm sure theres a function, but for some reason I can't find it on php.net -- maybe I misread something. Thanks for any help! Quote Link to comment https://forums.phpfreaks.com/topic/71449-deleting-a-directory-with-contents-inside/ Share on other sites More sharing options...
BlueSkyIS Posted October 1, 2007 Share Posted October 1, 2007 before i'd write a script, i'd log in and work on the rm command. assuming you're not windows. login meaning via SSH, telnet if necessary. Quote Link to comment https://forums.phpfreaks.com/topic/71449-deleting-a-directory-with-contents-inside/#findComment-359686 Share on other sites More sharing options...
Orio Posted October 1, 2007 Share Posted October 1, 2007 http://php.net/rmdir although you need to empty it from files first! Orio. Quote Link to comment https://forums.phpfreaks.com/topic/71449-deleting-a-directory-with-contents-inside/#findComment-359687 Share on other sites More sharing options...
Warptweet Posted October 2, 2007 Author Share Posted October 2, 2007 I saw the "unlink();" function, and was wondering, is it possible to use that to delete an entire directory and all it's contents? Because of course, my problem is theres too many files in my directory, making rmdir totally useless too me. Quote Link to comment https://forums.phpfreaks.com/topic/71449-deleting-a-directory-with-contents-inside/#findComment-359717 Share on other sites More sharing options...
teng84 Posted October 2, 2007 Share Posted October 2, 2007 i guess you have to delete all the files in that dir using unlink and once empty use rmdir Quote Link to comment https://forums.phpfreaks.com/topic/71449-deleting-a-directory-with-contents-inside/#findComment-359719 Share on other sites More sharing options...
clearstatcache Posted October 2, 2007 Share Posted October 2, 2007 how about using any of the php function exec or system with the command "rm -r $dir_name".... Quote Link to comment https://forums.phpfreaks.com/topic/71449-deleting-a-directory-with-contents-inside/#findComment-359788 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.