Cannot remove empty directory

Bill Campbell linux-sxs
Wed Jun 15 16:04:48 PDT 2005


On Wed, Jun 15, 2005, Michael Hipp wrote:
>I'm trying to delete an empty directory - normally not a particularly 
>esoteric task :-)

rm -rf directory_to_be_removed

If this doesn't work, the directory may be on a file system with
extended attributes with the ``immutable'' setting on it or its
parent directory.  Check this with ``lsattr'' and change the
extended attributes with ``chattr''.

>  $ ls -lah
>  drwx------   1 michael michael    6 2005-06-15 14:10 apps
>  [snip]
>  $ rmdir apps
>  rmdir: `apps': Directory not empty
>  $ ls -la apps
>  total 4
>  drwx------   1 michael michael    6 2005-06-15 14:10 .
>  drwxr-xr-x  20 michael michael 4096 2005-06-15 14:10 ..
>  $ rm -drf apps
>  rm: cannot remove directory `apps': Directory not empty
>  $ rmdir --ignore-fail-on-non-empty apps
>  $ ls -lah
>  drwx------   2 michael michael   17 2005-06-15 14:15 apps
>  [snip]
>
>Can't do it as root either. It's empty but it ain't ("total 4"). What gives?
>
>Michael
>_______________________________________________
>Linux-users mailing list ( Linux-users at linux-sxs.org )
>Unsub/Password/Etc: 
>http://mail.linux-sxs.org/cgi-bin/mailman/listinfo/linux-users
>
>Need to chat further on this subject? Check out #linux-users on 
>irc.linux-sxs.org !
>

-- 
Bill
--
INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
UUCP:               camco!bill  PO Box 820; 6641 E. Mercer Way
FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; (206) 236-1676
URL: http://www.celestial.com/

``Now if there is one thing that we do worse than any other nation, it is
try and manage somebody else's affairs.''
    Will Rogers


More information about the Linux-users mailing list