From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 16942 invoked by alias); 12 Jan 2015 06:53:22 -0000 Mailing-List: contact zsh-users-help@zsh.org; run by ezmlm Precedence: bulk X-No-Archive: yes List-Id: Zsh Users List List-Post: List-Help: X-Seq: 19731 Received: (qmail 1604 invoked from network); 12 Jan 2015 06:53:20 -0000 X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on f.primenet.com.au X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.2 X-CMAE-Score: 0 X-CMAE-Analysis: v=2.1 cv=PYxIXZlY c=1 sm=1 tr=0 a=FT8er97JFeGWzr5TCOCO5w==:117 a=kj9zAlcOel0A:10 a=q2GGsy2AAAAA:8 a=oR5dmqMzAAAA:8 a=-9mUelKeXuEA:10 a=YNv0rlydsVwA:10 a=oD2Bvknqcv36y4SdDaQA:9 a=CjuIK1q_8ugA:10 From: Bart Schaefer Message-id: <150111225306.ZM5543@torch.brasslantern.com> Date: Sun, 11 Jan 2015 22:53:06 -0800 In-reply-to: <20150112061032.GA12419@solfire> Comments: In reply to Meino.Cramer@gmx.de "Sort directory tree contents by time completly ?" (Jan 12, 7:10am) References: <20150112061032.GA12419@solfire> X-Mailer: OpenZMail Classic (0.9.2 24April2005) To: zsh-users@zsh.org Subject: Re: Sort directory tree contents by time completly ? MIME-version: 1.0 Content-type: text/plain; charset=us-ascii On Jan 12, 7:10am, Meino.Cramer@gmx.de wrote: } } Suppose there is a directory tree with very old, midaged and very } ypung file in. There are also empty directories and symlinks. } } Is it possible with zsh to get a directory listing of *all* files } in kind of the output of "ls -l", where all files are in one } long list, which is sorted by the timestamp of those files -- If there are not too many files, you can just do: ls -ldt **/* This will work for up to a few thousand files depending on how deep the directory tree is (i.e., how long the path names are). If the above gives an "arguments too long" or similar error, try: print -Nr **/*(Om) | xargs -0 ls -ldt You need to tell both zsh and ls to sort the same way or ls reorders the groups of names fed it by xargs. If you want oldest files first, use **/*(om) and ls -ldtr You can also use zstat (from the zsh/stat module) to build the output strings yourself instead of calling ls, but that's probably slower.