Re: deleting directories
| From: | Afan Pasalic | Date: | Tue, 21 Sep 2004 17:38:06 +0000 |
| Subject: | Re: deleting directories | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-197445@lists.php.net to get a copy of this message | ||
Thanks Jesse, but I don't have an access to server. Just FTP. That's why I have to use php script.
Jesse Castro wrote:
rm -r <directoryname> will recursively remove the directory and everything in it -----Original Message----- From: Afan Pasalic [mailto:afan@afan.net] 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