views:

459

answers:

5

I am having a frequent problems with my web hosting (its shared)

I am not able to delete or change permission for a particular directory. The response is "Cannot delete. Directory may not be empty". I checked the permissions and it looks OK. There are 100s of files in this folder which I dont want.

I contacted my support and they solved it saying it was permission issue. But it reappeared. Any suggestions?

The server is Linux.

A: 

recontact support.

Bob Dizzle
A: 

Though this is for files you might first want to check out the suggestions here.

Huppie
A: 

This could also be because your FTP client might not be showing the hidden files (like cache, or any hiddn files that your application might create), while the hidden files are preventing you from deleting the directory. (though, in your case, I am not sure if this is the cause .. .it could be permission issue with your hosting provider.. Webserver running as another user (like apache or www) combined with your directories having global write perms).

Ram Prasad
+3  A: 

You can't rmdir a directory with files in it. You must first rm all files and subdirectories. Many times, the easiest solution is:

$ rm -rf old_directory

It's entirely possible that some of the files or subdirectories have permission limitations that might prevent them from being removed. Occasionally, this can be solved with:

$ chmod -R +w old_directory

But I suspect that's what your support people did earlier.

Jon Ericson
A: 

I assume that's a response from an FTP server?

Usually, a message from an FTP server really means it. If it says the directory is not empty, there might be certain files you cannot see that exists in the directory which maybe one of:

  • Your PHP/JSP/ASP/whatever scripts may run under a different user account thus creating files which you may not be able to see/delete
  • Is your hosting's web interface run under your FTP account? There might be conflicting permissions there if you manage some files from the web interface and then later via FTP.
  • Hosting server/operating system files created unintentionally e.g. from the hosting's web interface

If it comes from a script, write a one-time throw-away script that delete the files and that directory and then uploads and executes it.

And just to be sure, some FTP server doesn't support direct directory deletion, you need all the files first, is that the case?

chakrit