I supposedly don't have the permissions to delete some directories in my site...
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
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,
You can open a ticket or use this php script that seems to remove a directory and its contents within it.
PHP Code:
<?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); ?>
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||
You can open a ticket or use this php script that seems to remove a directory and its contents within it.
PHP Code:
<?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.
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.
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?
__________________
||||If you are getting paid to do a job, don't ask for help on it!||||