I just installed the module "Image Picker" & uninstalled it shortly afterwards (as it was not what I needed).
So I disabled it on the modules page & then deleted it from the modules directory.
The problem is that it has left behind a folder "imagepicker" in files & I cannot delete them.
Each time I try, I get a 'permission denied' error.
example :

Response: 200 PORT command successful
Command: LIST
Response: 150 Opening ASCII mode data connection for file list
Response: 226 Transfer complete
Status: Directory listing successful
Command: DELE .htaccess
Response: 550 .htaccess: Permission denied

I've tried PASV aswell & have tried to CMOD but cannot.

Any idea why this happens & if there is a way I can fix it ?
It's pretty annoying as having undeletable folders/files left by a module isn't good.

Comments

Anonymous’s picture

This is a common problem in shared hosting accounts.
The files that cannot be removed are created with the account apache runs in.
You will need to ask your hosting company to have them removed.

-----------------------------------------
Joep
CompuBase, Drupal websites and design

steve-psngs’s picture

thanks for the reply.
I think that the problem lies with the script the module uses to create the directories/files.
It's pretty annoying as one tests a module & then can't get rid of what it creates.

steve-psngs’s picture

follow up : perhaps useful to someone else encountering a similar problem.

Contacted my host & they pointed me to a couple of scripts that allow one to change the permissions of the php script created httpd files.
Just save these codes as a php file & upload it not in the directory of the locked files, but the directory above eg files/frkedit where frkedt is locked, you'd place the php in /files & then point your browser to it to make it run.

<?php
   $old = umask(0000);
   chmod("name of folder or flile", 0777);
   umask($old);
?>

sets the permissions to 777 meaning you can delete them.

This one if you have wanted to changer the permissions in a whole directory/sub directorys etc)

<?php
   function rchmod($parent, $dmod, $fmod) {
         if (is_dir($parent)) {
                 $old = umask(0000);
                 chmod($parent, $dmod);
                 umask($old);
                 if ($handle = opendir($parent)) {
                         while (($file = readdir($handle)) !== false) {
                           if ($file === "." or $file === "..") {
                                         continue;
                                 } elseif (is_dir($parent . '/' . $file)) {
                     rchmod($parent . '/' . $file, $dmod, $fmod);
                                 } else {
                                         $old = umask(0000);
                                         chmod($parent . '/' . $file, $fmod);
                                     umask($old);
                                 }
                         }
                         closedir($handle);
            }
         } else {
                 $old = umask(0000);
                 chmod($parent, $fmod);
                 umask($old);
         }
    }
    rchmod('folder name or file name/', 0777, 0666);
?>

Finally this one just deletes the files/folders (again , placed in the directory above the lcation of the locked folders/files.

<?
function effacer($dir)
    {
        if ($handle = opendir($dir))
        {
            while (($file = readdir($handle)) !== false)
            {
                if ($file === "." or $file === "..")
                {
                    continue;
                }
                elseif (is_dir($dir . '/' . $file))
                {
                    effacer($dir . '/' . $file);
                }
                else
                {
                    unlink($dir . '/' . $file);
                }
            }
            closedir($handle);
        }
        rmdir($dir);
    }

effacer('name of directory to delete/'); ?>

note : this was done on a apache server so I'm not sure if it works on other servers.

EllECTRONC’s picture

Respect to steve-psngs
These codes have very much helped me
Thanks!

mikewheaton’s picture

Thanks very much, I was able to use the second one to successfully change the permissions and delete the 'sites' folder. I created a file named "777.php" in my Drupal folder (at the same level as the sites folder, not within it) that contained the following:

   function rchmod($parent, $dmod, $fmod) {
         if (is_dir($parent)) {
                 $old = umask(0000);
                 chmod($parent, $dmod);
                 umask($old);
                 if ($handle = opendir($parent)) {
                         while (($file = readdir($handle)) !== false) {
                           if ($file === "." or $file === "..") {
                                         continue;
                                 } elseif (is_dir($parent . '/' . $file)) {
                     rchmod($parent . '/' . $file, $dmod, $fmod);
                                 } else {
                                         $old = umask(0000);
                                         chmod($parent . '/' . $file, $fmod);
                                     umask($old);
                                 }
                         }
                         closedir($handle);
            }
         } else {
                 $old = umask(0000);
                 chmod($parent, $fmod);
                 umask($old);
         }
    }
    rchmod('sites/', 0777, 0666);
3cwebdev’s picture

Bookmarking.

pazdera’s picture

very pro indeed!

worked like a charm =)

josco’s picture

Thank you so much! I've tried A LOT of things to get this one directory out of my root and it wouldn't delete. I just made a php file out of those codes and pointed to that file in my browser and finally, the directory is gone. Thank you....very much appreciated.

-Joshua H.

cym0ej12’s picture

thank you it worked

dflitner’s picture

Thank you so much. I've been tearing my hair out about deleting the sites folder from a defunct site on my shared host.

The 2nd script above still works great and enabled me to delete the folder.

eff_shaped’s picture

bookmarking

Anonymous’s picture

hi I'm having the same problem and i followed the solution with the php file but it seems like its not working can someone help by being a little bit more detailed this is what i did i located the php file outside the directory where i want to erase the content and tried to set the permission 777 but i wants allowed can someone help please