Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: listing/deleting empty directories recursively
- X-seq: zsh-users 9702
 
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
 
- To: zzapper <david@xxxxxxxxxx>, zsh-users@xxxxxxxxxx
 
- Subject: Re: listing/deleting empty directories recursively
 
- Date: Sat, 19 Nov 2005 19:39:07 +0000
 
- In-reply-to: <bbmun1d0k4e979qnmpvqap09j9ibn2vs7i@xxxxxxx>
 
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
 
- References: <tfrtn1dt9nf26m1rka6b9kg3bmcoa2evs4@xxxxxxx>	<200511191057.25776.cht@xxxxxxxxx>	<103un195cji6u17l0kj1ijkvfj2vn9o3r5@xxxxxxx>	<1051119160931.ZM19308@xxxxxxxxxxxxxxxxxxxxxxx>	<bbmun1d0k4e979qnmpvqap09j9ibn2vs7i@xxxxxxx>
 
On Nov 19,  5:07pm, zzapper wrote:
} Subject: Re: listing/deleting empty directories recursively
}
} >    rmdir --verbose **/*(/od)
} I presume this can be xarg?
Or zargs, as Stephane suggested.
} The disadvantage of this is that it produces a flood of warning
} messages which may prevent you spotting something untoward.
I guess the question is whether you want a short command or minimal
output.  You can do the recursive descent yourself, of course.
    function rmemptydir() {
      emulate -RL zsh
      local here=$REPLY
      local -a deep
      deep=( $here/*(N/+rmemptydir) )
      [[ -n $deep ]] && rmdir --verbose $deep
      reply=( $here(N^F) )
    }
    : *(N/+rmemptydir)
This all assumes a version of zsh recent enough that recursive calls
to the (e) glob qualifier don't cause a crash, and so that you have
the (+) qualifier shortcut.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author