Re: delete none-empty directory

From: Date: Mon, 23 Apr 2001 04:55:30 +0000
Subject: Re: delete none-empty directory
Groups: php.dev 
Request: Send a blank email to php-dev+get-52191@lists.php.net to get a copy of this message
Addressed to: mohammed oda <mohammedoda@gmx.de> <php-dev@lists.php.net> ** Reply to note from <derick@php.net> Mon, 23 Apr 2001 13:30:37 +0200 (CEST) > > On Mon, 23 Apr 2001, mohammed oda wrote: > > > hi > > can somebody help me how can i delete non-empty directory by php > > command(rmdir) or another command. > > with rmdir i can only delete empty directory. > > system ("rm -rf /"); I know this is not the list for this question (php-general would be much better) but that answer is vicious. That command will delete every file on the system that is writable by the web server, or the user running php. It is the right track, the answer is system( "rm -rf /path/to/directory/to/delete" ) Be very careful, if a hacker can trick your program, say by entering: Directory to delete: [somedirectory / ] and you don't catch it by closely checking your user input you are opening a BIG security hole on your system. Any further questions on this subject should be moved to the php-general list, php-dev is for the development _of_ php, not developing with it. Rick Widmer Internet Marketing Specialists http://www.developersdesk.com

« previous php.dev (#52191) next »