zsh-users
 help / color / mirror / code / Atom feed
From: Stephane Chazelas <Stephane_Chazelas@yahoo.fr>
To: zsh-users@sunsite.dk
Subject: Re: listing/deleting empty directories recursively
Date: Sat, 19 Nov 2005 15:59:44 +0000	[thread overview]
Message-ID: <20051119155944.GA4929@sc> (raw)
In-Reply-To: <200511191348.29062.cht@chello.at>

On Sat, Nov 19, 2005 at 01:48:29PM +0100, Christian Taylor wrote:
[...]
> for dir in **/*(/^F); do print $dir >> LOGFILE; rmdir $dir; done
> 
> or with the alternative syntax I really like:
> 
> for dir (**/*(/^F)) { print $dir >> LOGFILE; rmdir $dir }
> 
> As far as I can see, filenames generated this way are already quoted 
> correctly, so spaces and special characters shouldn't be an issue.

They will as you forgot the "-r" for print, and to mark the end
of options with "--" for both print and rmdir.

Moreover, note that that won't remove directories that only
contain empty directories, you may prefer:

zargs rmdir -- ./**/*(/od) 2> /dev/null

as rmdir won't remove non-empty dirs anyway.

-- 
Stéphane


  parent reply	other threads:[~2005-11-19 16:00 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 [this message]
2005-11-19 14:39     ` Lloyd Zusman
2005-11-19 16:09     ` Bart Schaefer
2005-11-19 17:07       ` zzapper
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=20051119155944.GA4929@sc \
    --to=stephane_chazelas@yahoo.fr \
    --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).