<p>I am having a frequent problems with my web hosting (its shared)</p>

<p>I am not able to delete or change permission for a particular directory. The response is,</p>

<pre><code>Cannot delete. Directory may not be empty
</code></pre>

<p>I checked the permissions and it looks OK. There are 100's of files in this folder which I don't want. </p>

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

<p>The server is Linux.</p>

[{'answer_id': 73529, 'author': 'Ram Prasad', 'author_id': 6361, 'author_profile': 'https://Stackoverflow.com/users/6361', 'pm_score': 0, 'selected': False, 'text': '<p>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).</p>\n'}, {'answer_id': 73549, 'author': 'Jon Ericson', 'author_id': 1438, 'author_profile': 'https://Stackoverflow.com/users/1438', 'pm_score': 3, 'selected': True, 'text': "<p>You can't <strong>rmdir</strong> a directory with files in it.  You must first <strong>rm</strong> all files and subdirectories.  Many times, the easiest solution is:</p>\n\n<pre><code>$ rm -rf old_directory\n</code></pre>\n\n<p>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:</p>\n\n<pre><code>$ chmod -R +w old_directory\n</code></pre>\n\n<p>But I suspect that's what your support people did earlier.</p>\n"}, {'answer_id': 73584, 'author': 'chakrit', 'author_id': 3055, 'author_profile': 'https://Stackoverflow.com/users/3055', 'pm_score': 0, 'selected': False, 'text': "<p>I assume that's a response from an FTP server?</p>\n\n<p>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:</p>\n\n<ul>\n<li>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</li>\n<li>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.</li>\n<li>Hosting server/operating system files created unintentionally e.g. from the hosting's web interface</li>\n</ul>\n\n<p>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.</p>\n\n<p>And just to be sure, some FTP server doesn't support direct directory deletion, you need all the files first, is that the case?</p>\n"}]
['https://Stackoverflow.com/questions/73474', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/12178/']