Zsh Mailing List Archive
Messages sorted by: Reverse Date, Date, Thread, Author

Re: listing/deleting empty directories recursively



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