rm -r <directoryname> will recursively remove the directory and everything in it
-----Original Message----- From: Afan Pasalic [mailto:[EMAIL PROTECTED] Sent: Tuesday, September 21, 2004 12:31 PM To: php-general Subject: [PHP] deleting directories I have directory with huge number of directories (names by date artwork requested and client id number) with clients artwork. by accident, directory was opened by FrontPage and now in each directory is created _vti_cnf directory with copy of the artwork. i have to delete all those '_vti_cnf' directories. Since I don't have root access to server (shared hosting) I made a php script: $path = getcwd(); echo "Current Directory: $path<hr>"; function list_directory($path) { if ($dir = opendir($path)) { while($file = readdir($dir)) { if($file != '.' and $file != '..') { echo "<b>$file</b>"; if($file == '_vti_cnf') { rmdir($path."/".$file); } else { if(is_dir($file)) list_directory($file); } } } } closedir($dir); } list_directory($path); But, it doesn't work. I'm getting this Warnings: Warning: rmdir(20040301-040434-1411/_vti_cnf): Directory not empty in c:\ap\artwork\ap.php on line 19 Is there any other function that allows me to delete even not-empty directories? Or somebody has better idea? Thanks. Afan -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php