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

Re: ls most recent files in a hierarchy



Hi,

* Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx> typed:
> On Mar 16,  2:46am, Christian Schneider wrote:
> } Subject: Re: ls most recent files in a hierarchy
> }
> } > 2) list x most recent files in each directory of a hierarchy
> } 
> } ls **/*(D.om[1,5]) # 5 recent files
> 
> As Lloyd has pointed out, that's actually the answer to #3:

Thats correct. I get it wrong. Sorry about that.

> } > 3) list x most recent files in a hierarchy
> 
> The answer to #2 is less obvious:
> 
>   ls *(ND.om[1,5]) **/*(D/e:'reply=( $REPLY/*(ND.om[1,5]) )':)
> 
> That also requires a fairly recent version of zsh; none of the 4.2.x
> series has the fix, they'll either crash or go into an infinite loop
> when presented with the glob-within-a-glob.
> 
> For the 4.2.x line, you need something like:
> 
>   dirs=( '' **/*(DM/) ) eval 'ls ${^dirs}*(ND.om[1,5])'
> 
> which is perhaps clearer anyway and works in 4.3.x too.

Thanks! I can can dispose it on a old^Wstable Debian i also managed.
-- 
Could I have a drug overdose?



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