Getting Started

ID #209

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

Applies to: Grid System

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.

Last update: 2010-10-03 16:31
Author: FAQ Admin
Revision: 1.2

Digg it! Share on Facebook Print this record Send FAQ to a friend Show this as PDF file
Please rate this FAQ:

Average rating: 3.25 (20 Votes)

completely useless 1 2 3 4 5 most valuable

You can comment this FAQ

Comment of Anonymous:
There's an option to "rmdir" to ignore non-empty directory failures:


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

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

Added at: 2003-01-17 14:00

Comment of Anonymous:
The --ignore... switch didn't work for me.
Added at: 2003-03-25 15:01

Comment of Anonymous:
The "--ignore-fail-on-non-empty" just keeps it from displaying "rmdir ´directory': directory not empty". The rm -rf option works great.
Added at: 2005-08-14 16:09