GNU bug report logs - #12339
Bug: rm -fr . doesn't dir depth first deletion yet it is documented to do so.

Previous Next

Package: coreutils;

Reported by: Linda Walsh <coreutils <at> tlinx.org>

Date: Mon, 3 Sep 2012 00:34:02 UTC

Severity: normal

Done: Assaf Gordon <assafgordon <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #209 received at 12339 <at> debbugs.gnu.org (full text, mbox):

From: Eric Blake <eblake <at> redhat.com>
To: Linda Walsh <coreutils <at> tlinx.org>
Cc: Alan Curry <pacman-cu <at> kosh.dhis.org>, 12339 <at> debbugs.gnu.org
Subject: Re: bug#12339: Bug: rm -fr . doesn't dir depth first deletion yet it
Date: Fri, 07 Sep 2012 18:23:40 -0600
[Message part 1 (text/plain, inline)]
On 09/07/2012 06:02 PM, Linda Walsh wrote:

> The thing is, by doing rm -rf on ., I am not trying to remove . or ..
> I'm trying to remove the files in it.
> 
> Other wise there is no way to specify, using "rm" to delete the contents
> of a directory  but not the directory itself.

Yes there is, and Paul already told it to you:

rm -rf * .[!.] .??*

> 
> I just want to "clean" out a directory -- I don't want to try to delete the
> directory itself.

Then use the triple-glob.  This is portable to both POSIX and to the old
implementations we have been discussing.

-- 
Eric Blake   eblake <at> redhat.com    +1-919-301-3266
Libvirt virtualization library http://libvirt.org

[signature.asc (application/pgp-signature, attachment)]

This bug report was last modified 6 years and 186 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.