[PLUG] Sorted find command

Anderson, Rob (Global Trade) Rob.Anderson at nike.com
Tue Apr 27 10:08:01 UTC 2004


Michael Montagne wrote:

"I need to find all the files from last november 1 and return a sorted
list by date.
My attempt "find . -mtime -179 -ls -exec ls -ltr {} \;" does not sort.

Seems to me like this should work.  Can some offer a helpful hint?"

Michael,

ls -ltr will sort by date/time. However, in this case you are calling ls -ltr on each file that you are finding, individually, and therefore loosing the context by which the sorting would occur.

-Rob Anderson





More information about the PLUG mailing list