...

View Full Version : I supposedly don't have the permissions to delete some directories in my site...



Millenia
08-31-2008, 11:15 PM
I have 300MB space on my hosting. Not much, but enough for what I am using it for. However, some of it has been taken up by files that refuse to be deleted. It starts after trying to uninstall a Fantastico script. When I click uninstall, I have to prepare it for removal, then remove it. When I click remove, nothing happens. So I end up deleting the database and the file by hand. Although about 10MB of the script remains in my public_html, and when I try and delete it, it tells me I don't have enough permissions.

I'm not trying to solve the Fantastico thing, I don't use it. But I would like to get rid of the directories I don't want. Is there anyway? I tried using a PHP script but I didn't actually know what I was doing. If anyone could help me get rid of these damned files I would be very grateful. Thanks

oesxyl
09-01-2008, 01:19 AM
I have 300MB space on my hosting. Not much, but enough for what I am using it for. However, some of it has been taken up by files that refuse to be deleted. It starts after trying to uninstall a Fantastico script. When I click uninstall, I have to prepare it for removal, then remove it. When I click remove, nothing happens. So I end up deleting the database and the file by hand. Although about 10MB of the script remains in my public_html, and when I try and delete it, it tells me I don't have enough permissions.

I'm not trying to solve the Fantastico thing, I don't use it. But I would like to get rid of the directories I don't want. Is there anyway? I tried using a PHP script but I didn't actually know what I was doing. If anyone could help me get rid of these damned files I would be very grateful. Thanks
you can't remove them because you are not the owner of the files/directories, and you can't change the owner because you have not enought permision, that's a guess, :)
The only way is to open a support ticket and ask them to remove or change owner. If is not a free server without any support included they will fix it, :)

best regards

_Aerospace_Eng_
09-01-2008, 04:34 AM
You can open a ticket or use this php script that seems to remove a directory and its contents within it.

<?php
$directory = 'path/to/directory';
function deleteDir($dir) {
// open the directory
$dhandle = opendir($dir);

if ($dhandle) {
// loop through it
while (false !== ($fname = readdir($dhandle))) {
// if the element is a directory, and
// does not start with a '.' or '..'
// we call deleteDir function recursively
// passing this element as a parameter
if (is_dir( "{$dir}/{$fname}" )) {
if (($fname != '.') && ($fname != '..')) {
echo "<u>Deleting Files in the Directory</u>: {$dir}/{$fname} <br />";
deleteDir("$dir/$fname");
}
// the element is a file, so we delete it
} else {
echo "Deleting File: {$dir}/{$fname} <br />";
unlink("{$dir}/{$fname}");
}
}
closedir($dhandle);
}
// now directory is empty, so we can use
// the rmdir() function to delete it
echo "<u>Deleting Directory</u>: {$dir} <br />";
rmdir($dir);
}

// call deleteDir function and pass to it
// as a parameter a directory name
deleteDir($directory);
?>

oesxyl
09-01-2008, 03:24 PM
You can open a ticket or use this php script that seems to remove a directory and its contents within it.

If I understand the problem, the script will not work in op case, the only solution is to have root access.

if script can delete the files/directories, a easy way then that is to remove the directory from a ftp client
best regards

Millenia
09-01-2008, 03:53 PM
You can open a ticket or use this php script that seems to remove a directory and its contents within it.

<?php
$directory = 'path/to/directory';
function deleteDir($dir) {
// open the directory
$dhandle = opendir($dir);

if ($dhandle) {
// loop through it
while (false !== ($fname = readdir($dhandle))) {
// if the element is a directory, and
// does not start with a '.' or '..'
// we call deleteDir function recursively
// passing this element as a parameter
if (is_dir( "{$dir}/{$fname}" )) {
if (($fname != '.') && ($fname != '..')) {
echo "<u>Deleting Files in the Directory</u>: {$dir}/{$fname} <br />";
deleteDir("$dir/$fname");
}
// the element is a file, so we delete it
} else {
echo "Deleting File: {$dir}/{$fname} <br />";
unlink("{$dir}/{$fname}");
}
}
closedir($dhandle);
}
// now directory is empty, so we can use
// the rmdir() function to delete it
echo "<u>Deleting Directory</u>: {$dir} <br />";
rmdir($dir);
}

// call deleteDir function and pass to it
// as a parameter a directory name
deleteDir($directory);
?>

I'll try that, the script I tried was 2 lines long...No wonder it didn't work.

Edit: it didn't work, it just said "Deleting *my file name*" and nothing happened. The directory wasn't removed. But thanks for trying. I suppose I'll contact my host.

Oh and by the way, I tried using a FTP client.

BabyJack
09-01-2008, 04:45 PM
I have the same problem. Basically, there's files in there that have nothing inside them. This is what's causing the problem. You need to fill them up, then try and remove them.

_Aerospace_Eng_
09-01-2008, 06:45 PM
I'll try that, the script I tried was 2 lines long...No wonder it didn't work.

Edit: it didn't work, it just said "Deleting *my file name*" and nothing happened. The directory wasn't removed. But thanks for trying. I suppose I'll contact my host.

Oh and by the way, I tried using a FTP client.

Did you change the $directory variable?

Millenia
09-01-2008, 06:56 PM
It's sorted now.

Logged on as root, and deleted the files through Legacy File Manager.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum