Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
Re: Sort directory tree contents by time completly ?
- X-seq: zsh-users 19731
- From: Bart Schaefer <schaefer@xxxxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxx
- Subject: Re: Sort directory tree contents by time completly ?
- Date: Sun, 11 Jan 2015 22:53:06 -0800
- In-reply-to: <20150112061032.GA12419@solfire>
- List-help: <mailto:zsh-users-help@zsh.org>
- List-id: Zsh Users List <zsh-users.zsh.org>
- List-post: <mailto:zsh-users@zsh.org>
- Mailing-list: contact zsh-users-help@xxxxxxx; run by ezmlm
- References: <20150112061032.GA12419@solfire>
On Jan 12, 7:10am, Meino.Cramer@xxxxxx 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.
Messages sorted by:
Reverse Date,
Date,
Thread,
Author