Home
 

Customer Support

Search for keywords:

Browse by category:

Why does it say "directory not empty" when I try to
remove a directory?

The reason is because the directory is NOT empty. It has at least one file under it somewhere that begins with a period (.) so that it is hidden or invisible to the regular 'ls' command.

In order to see and delete these hidden files,

1) Get a shell prompt and type:

ls -la /htdocs/www/dirname


where /htdocs/www/dirname is the full path to the directory that you are trying to delete. Doing that will show you all the hidden files inside the directory. You can then delete the hidden file individually like this:

rm -f /htdocs/www/dirname/.hiddenfile


Or you can just delete the entire directory without regard to what is still inside it by typing:

rm -rf /htdocs/www/dirname


2) To delete a directory that still has hidden files in it with your FTP program, first turn on your ability to see hidden files with your FTP program. Then click on the revealed hidden file and delete it with your FTP program as you normally would any other file. When you've gotten rid of all the hidden files, you will be able to delete the directory that they were under.

User-Contributed Notes

add a note
17-Jan-2003 14:00
There's an option to "rmdir" to ignore non-empty directory failures:

--ignore-fail-on-non-empty 

  "ignore each failure that is solely because a directory is non-empty" 

rmdir --ignore-fail-on-non-empty dirname


no_spam -at- sohochicago.com
25-Mar-2003 15:01
The --ignore... switch didn't work for me.

anonymous -at- example.com
14-Aug-2005 16:09
The "--ignore-fail-on-non-empty" just keeps it from displaying "rmdir
`directory': directory not empty". The rm -rf option works great.

add a note

Related Questions:


How do I create subdomains?

How do I get telnet or SSH access to the server?

What is the real full path to my home directory?

Where do I put my webpages and files?

How do I upload and edit my files?

Can I have a catch-all subdomain?

Why do I keep getting old copies of my pages when I just updated and changed my files?

How do I change my password?

When will my site be activated?

How do I get to one of my subdomains from a temp.modwest.com or secure.modwest.com URL?

Can I switch my domain name or alter my administrator username?

How do I recreate the "_" symlink that directs mydomain.com to www.mydomain.com?

Why do I Get an Error Page When Accessing Webmail with Internet Explorer?

What kind of resource limits do you have for your shared hosting environment?

Can I display a "Secured by RapidSSL" seal on my site?

Browse Categories:

Getting Started, FTP, Telnet/SSH, Moving Domains, E-mail, Traffic Reports, Mailing Lists, Apache, PHP, CGI, Other Server-Side Scripting, MySQL Database, Imaging Libraries, Other Software, Billing & Terms, Control Panel, E-commerce, Pre-Sales


Tiny Modwest Logo         Copyright 2000-2008 by Modwest, Inc.          About Us    |    Blog    |    Jobs    |    Web Design    |    Contact Us