* Tip of the day: prune empty directory hierarchies
@ 2015-06-29 14:59 Peter Stephenson
2015-07-03 20:04 ` zzapper
0 siblings, 1 reply; 2+ messages in thread
From: Peter Stephenson @ 2015-06-29 14:59 UTC (permalink / raw)
To: Zsh Users' List
In case anybody ever wanted this and there isn't a standard solution I
don't know about...
pws
# Prune empty directory hierarchies below the current directory. That's
# a hierarchy where everything underneath is itself a directory.
#
# The first search is slow, but subsequently it simply goes up one
# directory each time so it's much faster.
local -aU dirs
dirs=(**/*(ND/^F))
while (( ${#dirs} )); do
rmdir $dirs || return
# print Pruhed ${#dirs} directories...
dirs=(${^dirs:h}(ND/^F))
done
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: Tip of the day: prune empty directory hierarchies
2015-06-29 14:59 Tip of the day: prune empty directory hierarchies Peter Stephenson
@ 2015-07-03 20:04 ` zzapper
0 siblings, 0 replies; 2+ messages in thread
From: zzapper @ 2015-07-03 20:04 UTC (permalink / raw)
To: zsh-users
Peter Stephenson <p.stephenson@samsung.com> wrote in
news:20150629155927.289729cb@pwslap01u.europe.root.pri:
> dirs=(**/*(ND/^F))
I'd appreciate a fuller explanation
--
zzapper
https://twitter.com/dailyzshtip
---
This email has been checked for viruses by Avast antivirus software.
https://www.avast.com/antivirus
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2015-07-03 20:04 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-06-29 14:59 Tip of the day: prune empty directory hierarchies Peter Stephenson
2015-07-03 20:04 ` zzapper
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).