Go Back   CodingForums.com > :: Client side development > General web building

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-31-2008, 10:15 PM   PM User | #1
Millenia
Open Source Zealot

 
Join Date: May 2008
Location: Lost in Localhost...
Posts: 702
Thanks: 3
Thanked 43 Times in 42 Posts
Millenia is on a distinguished road
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
Millenia is offline   Reply With Quote
Old 09-01-2008, 12:19 AM   PM User | #2
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by Millenia View Post
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
oesxyl is offline   Reply With Quote
Old 09-01-2008, 03:34 AM   PM User | #3
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
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!||||

Last edited by _Aerospace_Eng_; 09-01-2008 at 03:37 AM..
_Aerospace_Eng_ is offline   Reply With Quote
Old 09-01-2008, 02:24 PM   PM User | #4
oesxyl
Master Coder


 
Join Date: Dec 2007
Posts: 6,682
Thanks: 436
Thanked 890 Times in 879 Posts
oesxyl is a jewel in the roughoesxyl is a jewel in the roughoesxyl is a jewel in the rough
Quote:
Originally Posted by _Aerospace_Eng_ View Post
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.

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

best regards

Last edited by oesxyl; 09-01-2008 at 02:27 PM..
oesxyl is offline   Reply With Quote
Old 09-01-2008, 02:53 PM   PM User | #5
Millenia
Open Source Zealot

 
Join Date: May 2008
Location: Lost in Localhost...
Posts: 702
Thanks: 3
Thanked 43 Times in 42 Posts
Millenia is on a distinguished road
Quote:
Originally Posted by _Aerospace_Eng_ View Post
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.

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

Last edited by Millenia; 09-01-2008 at 02:57 PM..
Millenia is offline   Reply With Quote
Old 09-01-2008, 03:45 PM   PM User | #6
BabyJack
Regular Coder

 
BabyJack's Avatar
 
Join Date: Apr 2008
Location: Somewhere.
Posts: 602
Thanks: 43
Thanked 6 Times in 6 Posts
BabyJack is an unknown quantity at this point
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.
__________________
Enlightenment in Coding
Validate before Posting | Google is your friend for PC Problems | Make sure you have a doctype
BabyJack is offline   Reply With Quote
Old 09-01-2008, 05:45 PM   PM User | #7
_Aerospace_Eng_
Supreme Master coder!


 
_Aerospace_Eng_'s Avatar
 
Join Date: Dec 2004
Location: In a place far, far away...
Posts: 19,293
Thanks: 2
Thanked 1,044 Times in 1,020 Posts
_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light_Aerospace_Eng_ is a glorious beacon of light
Quote:
Originally Posted by Millenia View Post
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!||||
_Aerospace_Eng_ is offline   Reply With Quote
Old 09-01-2008, 05:56 PM   PM User | #8
Millenia
Open Source Zealot

 
Join Date: May 2008
Location: Lost in Localhost...
Posts: 702
Thanks: 3
Thanked 43 Times in 42 Posts
Millenia is on a distinguished road
It's sorted now.

Logged on as root, and deleted the files through Legacy File Manager.
Millenia is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 05:49 PM.


Advertisement
Log in to turn off these ads.