PHP Tutorials: Removing a Directory with Contents

Loading...

Sign in or sign up now!
Alert icon
Upgrade to the latest Flash Player for improved playback performance. Upgrade now or more info.
15,288
Loading...
Alert icon
Sign in or sign up now!
Alert icon

Uploaded by on Dec 18, 2011

Deleting a directory containing files and/or subdirectories in PHP isn't possible using the rmdir function alone. You'll need to create a recursive function. It's easier than it sounds, and this tutorial shows you how!

Official website
http://phpacademy.org

Support Forum
http://phpacademy.org/forum

Follow us on Twitter!
http://twitter.com/phpacademy

  • likes, 0 dislikes

Link to this comment:

Share to:
see all

All Comments (40)

Sign In or Sign Up now to post a comment!
  • @3:51 It was probably a hoover but it sounded like an old kettle and I just though "I need a cuppa"

  • @anotherwaytodoit Actually, == doesn't check the type (string, int, bool, etc), so if you compare FALSE (boolean) to 'FALSE' (string), == will consider them the same since it does not look at types. Whereas if(0 === '0') will consider them unequal because one is an int and the other is a string. So, == is a less strict form of comparison, ignoring types, comparing if they simply match. === does essentially the same thing, except it must match INCLUDING the data type.

  • thanks nice tutorial for recursive func.

  • @no4ash

    === is case sensetive (strict comparison) while == is not,

    same thing with !== and !=

  • please increase font size

  • why use === instead of ==

  • use this guys it really works..

    system('/bin/rm -rf '.escapeshellarg('foldername')­);

  • Just wanted to say this was an excellent series of tutorials - Very clear and well presented!! Keep up the good work :-)

  • nice tutorial :D you are nerd in php alex!

  • Best tutorials, from you!

    Since 2009

Loading...

Alert icon
0 / 00Unsaved Playlist Return to active list
    1. Your queue is empty. Add videos to your queue using this button:
      or sign in to load a different list.
    Loading...Loading...Saving...
    • Clear all videos from this list
    • Learn more