rm -d...why won´t this remove a directory?

anthony baldwin anthony.baldwin01 at comcast.net
Fri Nov 16 14:50:38 UTC 2007


Colin Watson wrote:
> 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.
> 

Thanks for clearing that up for me.
I was a little confused on that point.

/tony

-- 

http://www.baldwinglinguas.com
translations: EN, FR, ES, PT
-----BEGIN GEEK CODE BLOCK-----
Version: 3.12
GL d- s-:-- a C+++ UL++ P L+++ E---- W++ N+ o- K- w--
O- M+ V- PS++ PE-- Y+ PGP+ t+ 5 X+ R tv b++++ DI D----
G e+++ h---- r+++ y++++
------END GEEK CODE BLOCK------




More information about the ubuntu-users mailing list