zsh-users
 help / color / mirror / code / Atom feed
From: zzapper <david@tvis.co.uk>
To: zsh-users@sunsite.dk
Subject: Re: listing/deleting empty directories recursively
Date: Sat, 19 Nov 2005 17:07:04 +0000	[thread overview]
Message-ID: <bbmun1d0k4e979qnmpvqap09j9ibn2vs7i@4ax.com> (raw)
In-Reply-To: <1051119160931.ZM19308@candle.brasslantern.com>

On Sat, 19 Nov 2005 16:09:31 +0000,  wrote:

>On Nov 19, 11:28am, zzapper wrote:
>} Subject: Re: listing/deleting empty directories recursively
>}
>} >ls -ld **/*(/^F)
>} >
>} >Christian
>} 
>} Now I'd like to rm those directories, and log which ones were deleted. 
>
>On a GNU-ish system?
>
>    rmdir --verbose **/*(/^F)
>
>You can work out the stderr redirections yourself.
>
>Of course you realize that this only finds/removes empty leaf directories.
>Every time you remove a directory you might discover that its parent has
>also become empty.  For that reason you might be better off doing a depth-
>first traversal attempting to remove *all* directories, and simply allow
>rmdir to fail if the directory isn't empty.
>
>    rmdir --verbose **/*(/od)
I presume this can be xarg?
eg
print **/*(/od) |  xargs -n1 -t rmdir

The disadvantage of this is that it produces a flood of warning messages which may prevent you
spotting something untoward.


-- 
zzapper
Success for Techies and Vim,Zsh tips
http://SuccessTheory.com/


  reply	other threads:[~2005-11-19 17:10 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2005-11-19  9:19 zzapper
2005-11-19  9:57 ` Christian Taylor
2005-11-19 11:28   ` zzapper
2005-11-19 11:56     ` Thor Andreassen
2005-11-19 11:59       ` Thor Andreassen
2005-11-19 12:48         ` Christian Taylor
2005-11-19 14:54           ` Thorsten Kampe
2005-11-19 15:59           ` Stephane Chazelas
2005-11-19 14:39     ` Lloyd Zusman
2005-11-19 16:09     ` Bart Schaefer
2005-11-19 17:07       ` zzapper [this message]
2005-11-19 19:39         ` Bart Schaefer
  -- strict thread matches above, loose matches on Subject: below --
2005-11-18 19:49 zzapper

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bbmun1d0k4e979qnmpvqap09j9ibn2vs7i@4ax.com \
    --to=david@tvis.co.uk \
    --cc=zsh-users@sunsite.dk \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).