bug-coreutils
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Could we have a flag to tell us which directories were actually remo


From: Bob Proulx
Subject: Re: Could we have a flag to tell us which directories were actually removed?
Date: Wed, 15 Aug 2007 14:50:57 -0600
User-agent: Mutt/1.5.9i

Reuben Thomas wrote:
> I just had a situation where this would have been useful. I tried -v 
> --ignore-fail-on-non-empty, but of course it told me about every directory 
> it processed, which is fine, but not what I wanted.

How about this?

  $ mkdir -p 1/2/3 11
  $ rmdir -v 1
  rmdir: removing directory, 1
  rmdir: 1: Directory not empty
  $ echo $?
  1

And this does not seem like the type of thing that needs to be
optimized for keyboard use but sounds more like something in a script.
In which case a little more verbose is okay.  That leads me to this:

  for dir in *; do
    rmdir $dir && echo removed: $dir  # or whatever you want to do here
  done

Bob




reply via email to

[Prev in Thread] Current Thread [Next in Thread]