Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: listing/deleting empty directories recursively
- X-seq: zsh-users 9697
- From: Lloyd Zusman <ljz@xxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: listing/deleting empty directories recursively
- Date: Sat, 19 Nov 2005 09:39:32 -0500
- Cancel-lock: sha1:/AOxAlHsE561xJyyKxWLE1r4D3c=
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <tfrtn1dt9nf26m1rka6b9kg3bmcoa2evs4@xxxxxxx> <200511191057.25776.cht@xxxxxxxxx> <103un195cji6u17l0kj1ijkvfj2vn9o3r5@xxxxxxx>
- Sender: news <news@xxxxxxxxxxxxx>
zzapper <david@xxxxxxxxxx> writes:
> On Sat, 19 Nov 2005 10:57:25 +0100, wrote:
>
>>> ls -ld *(/^F)
>>>
>>> Will list any empty directories, but only for one level of subdirectories,
>>> how to make it delete empty directories at any level.
>>
>>ls -ld **/*(/^F)
>>(will list empty directories at any level in the current working directory)
>>
>>Christian
> Thanx works just dandy,
> Now I'd like to rm those directories, and log which ones were deleted.
How about this?
print **/*(/^F) | xargs -n1 -t rmdir
The xargs command dates back to something like 1977, in the infancy of
Unix. It's still quite useful for tasks such as this one.
--
Lloyd Zusman
ljz@xxxxxxxxxx
God bless you.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author