* Sort directory tree contents by time completly ?
@ 2015-01-12 6:10 Meino.Cramer
2015-01-12 6:33 ` Jan Larres
2015-01-12 6:53 ` Bart Schaefer
0 siblings, 2 replies; 3+ messages in thread
From: Meino.Cramer @ 2015-01-12 6:10 UTC (permalink / raw)
To: zsh-users
Hi,
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 --
one file per line and each file with a complete path (not necessary
as absolute path but the directory should not be listed in the
header. I dont want heades.???
Thank you very much for any help in advance!
Best regards,
mcc
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Sort directory tree contents by time completly ?
2015-01-12 6:10 Sort directory tree contents by time completly ? Meino.Cramer
@ 2015-01-12 6:33 ` Jan Larres
2015-01-12 6:53 ` Bart Schaefer
1 sibling, 0 replies; 3+ messages in thread
From: Jan Larres @ 2015-01-12 6:33 UTC (permalink / raw)
To: zsh-users
On 12/01/15 19:10, Meino.Cramer@gmx.de wrote:
> 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 --
> one file per line and each file with a complete path (not necessary
> as absolute path but the directory should not be listed in the
> header. I dont want heades.???
Sounds like this should do what you want:
ls -l -rt **/*(.,@)
-Jan
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Sort directory tree contents by time completly ?
2015-01-12 6:10 Sort directory tree contents by time completly ? Meino.Cramer
2015-01-12 6:33 ` Jan Larres
@ 2015-01-12 6:53 ` Bart Schaefer
1 sibling, 0 replies; 3+ messages in thread
From: Bart Schaefer @ 2015-01-12 6:53 UTC (permalink / raw)
To: zsh-users
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.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2015-01-12 6:53 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-12 6:10 Sort directory tree contents by time completly ? Meino.Cramer
2015-01-12 6:33 ` Jan Larres
2015-01-12 6:53 ` Bart Schaefer
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).