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

Re: Tip of the day: prune empty directory hierarchies



2015-07-03 20:04:41 +0000, zzapper:
> Peter Stephenson <p.stephenson@xxxxxxxxxxx> wrote in 
> news:20150629155927.289729cb@xxxxxxxxxxxxxxxxxxxxxxxxx:
> 
> > dirs=(**/*(ND/^F))
> 
> I'd appreciate a fuller explanation
[...]

**/* recursive glob: any file in current directory and  below.
(ND/^F): glob qualifier: modify glob behaviour and further
filter files based on other attributes than name:
N: don't fail and don't expand to anything if there's no match
(nullglob)
D: include dot files and descend into dot dirs (don't ignore
hidden files).
/: select only files of type directory
^F: directories that are /not-full/. a "full" directory here is
one that contains at least one entry other than . and ..

Do **/*(ND/^F) is the list of empty directories (recursively).

-- 
Stephane



Messages sorted by: Reverse Date, Date, Thread, Author