zsh-users
 help / color / mirror / code / Atom feed
From: Bart Schaefer <schaefer@brasslantern.com>
To: zsh-users@zsh.org
Subject: Re: Sort directory tree contents by time completly ?
Date: Sun, 11 Jan 2015 22:53:06 -0800	[thread overview]
Message-ID: <150111225306.ZM5543@torch.brasslantern.com> (raw)
In-Reply-To: <20150112061032.GA12419@solfire>

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.


      parent reply	other threads:[~2015-01-12  6:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-01-12  6:10 Meino.Cramer
2015-01-12  6:33 ` Jan Larres
2015-01-12  6:53 ` Bart Schaefer [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=150111225306.ZM5543@torch.brasslantern.com \
    --to=schaefer@brasslantern.com \
    --cc=zsh-users@zsh.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).