Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: ls most recent files in a hierarchy
- X-seq: zsh-users 10034
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxx
- Subject: Re: ls most recent files in a hierarchy
- Date: Wed, 15 Mar 2006 19:57:31 -0800
- In-reply-to: <20060316014618.GC16669@xxxxxxxxxxxxxxxxxxx>
- Mailing-list: contact zsh-users-help@xxxxxxxxxx; run by ezmlm
- References: <Xns9788654E75Bzzappergmailcom@xxxxxxxxxxx> <20060316014618.GC16669@xxxxxxxxxxxxxxxxxxx>
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:
} > 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author