I'm trying to sort files by date, including those that reside in subdirectories. I got it to work by using:

find . -exec ls -lrt {} \+

which I found somewhere on StackOverflow. My initial try was to use:

ls -lrt `find .`

but it doesn't work. It sorts the contents of each directory by date, rather than all of them together.

Why do these produce different output?

link|improve this question
feedback

migrated from stackoverflow.com Dec 1 '11 at 4:41

This question came from our site for professional and enthusiast programmers.

1 Answer

Use d option of ls.

ls -lrtd `find .`
link|improve this answer
feedback

Your Answer

 
or
required, but never shown