rm -d...why won´t this remove a directory?
cjwatson at ubuntu.com
Fri Nov 16 14:42:57 UTC 2007
On Thu, Nov 15, 2007 at 01:10:29PM -0500, anthony baldwin wrote:
> Shouldn´t "sudo rm -d [directory name] remove a directory?
> rmdir will only remove empty dirs, and I am trying to remove a dir
> and it´s contents.
> I do
> sudo rm --directory -f music
> and get
> rm: cannot remove `music': Is a directory
As you found out, you want -r. However, to clarify rm's --help output:
-d, --directory unlink FILE, even if it is a non-empty directory
(super-user only; this works only if your system
supports `unlink' for nonempty directories)
The same rm code works on many kernels, not just Linux, which is why
this is there; but Linux is not one of the systems that supports
'unlink' on directories at all.
Colin Watson [cjwatson at ubuntu.com]
More information about the ubuntu-users