deleting directories
| From: | Afan Pasalic | Date: | Tue, 21 Sep 2004 17:31:24 +0000 |
| Subject: | deleting directories | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-197441@lists.php.net to get a copy of this message | ||
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