I'm getting a frequent issues with my website hosting (its shared)

I'm not in a position to remove or change permission for the directory. The fact is "Cannot remove. Directory might not be empty". I checked the permissions also it looks OK. You will find hundreds of files within this folder that we dont want.

I approached my support plus they solved it saying it had been permission problem. However it reappeared. Any suggestions?

The server is Linux.

I suppose this is a response from an FTP server?

Usually, a note from an FTP server really means it. Whether it states your directory isn't empty, there can be certain files you can't observe that is available within the directory which maybe among:

  • Your PHP/JSP/ASP/whatever scripts might run within different user account thus creating files which you might not have the ability to see/remove
  • Is the hosting's web interface run beneath your FTP account? There can be conflicting permissions there just try some files on the internet interface after which later via FTP.
  • Hosting server/operating-system files produced inadvertently e.g. in the hosting's web interface

Whether it develops from a script, write a 1-time throw-away script that remove the files which directory after which uploads and executes it.

And merely to be certain, some FTP server does not support direct directory deletion, you'll need all of the files first, would be that the situation?

recontact support.

Though to files you may first want to look into the suggestions here.

This may be since your FTP client is probably not showing the hidden files (like cache, or any hiddn files that the application could create), as the hidden files are stopping you against removing your directory. (though, inside your situation, I don't know if this sounds like the reason .. .it may be permission problem together with your host company.. Webserver running as the second user (like apache or www) coupled with your sites getting global write perms).

You cannot rmdir a directory with files inside it. You have to first rm all files and subdirectories. Many occasions, the simplest option would be:

$ rm -rf old_directory

It's feasible that a few of the files or subdirectories have permission restrictions that may prevent them from being removed. From time to time, this is often solved with:

$ chmod -R +w old_directory

However I suspect that is what your support people did earlier.