home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam    

Book HomePHP CookbookSearch this book

19.12. Removing a Directory and Its Contents

19.12.2. Solution

On Unix, use rm:

$directory = escapeshellarg($directory);
exec("rm -rf $directory");

On Windows, use rmdir:

$directory = escapeshellarg($directory);
exec("rmdir /s /q $directory");

19.12.4. See Also

Documentation on rmdir( ) at http://www.php.net/rmdir; your system's rm or rmdir documentation, such as the Unix rm(1) manpage or the Windows rmdir /? help text.

Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.