Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Regular Coder
    Join Date
    May 2008
    Location
    Lost in Localhost...
    Posts
    702
    Thanks
    3
    Thanked 43 Times in 42 Posts

    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

  • #2
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    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

  • #3
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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);
    ?>
    Last edited by _Aerospace_Eng_; 09-01-2008 at 03:37 AM.
    ||||If you are getting paid to do a job, don't ask for help on it!||||

  • #4
    Master Coder
    Join Date
    Dec 2007
    Posts
    6,682
    Thanks
    436
    Thanked 890 Times in 879 Posts
    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.

  • #5
    Regular Coder
    Join Date
    May 2008
    Location
    Lost in Localhost...
    Posts
    702
    Thanks
    3
    Thanked 43 Times in 42 Posts
    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.

  • #6
    Regular Coder BabyJack's Avatar
    Join Date
    Apr 2008
    Location
    Somewhere.
    Posts
    602
    Thanks
    43
    Thanked 6 Times in 6 Posts
    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

  • #7
    Supreme Master coder! _Aerospace_Eng_'s Avatar
    Join Date
    Dec 2004
    Location
    In a place far, far away...
    Posts
    19,291
    Thanks
    2
    Thanked 1,043 Times in 1,019 Posts
    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!||||

  • #8
    Regular Coder
    Join Date
    May 2008
    Location
    Lost in Localhost...
    Posts
    702
    Thanks
    3
    Thanked 43 Times in 42 Posts
    It's sorted now.

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


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •