List all files in a directory, order by date

Nothing original, the Internet is full of good recommendations, but I had to come up with my own answer:

  1. cd to the upper-level directory
  2. run:  find . -type f -print0 | xargs -0 ls -rtl | awk '{print $6 " " $7 " " $8 " " $9}'

Explanation:

  • find recursively looks for regular files starting from the current directory, output is a long uninterrupted list
  • xargs is used to pass the above output to ls which will display in reverse order, by time, in long format
  • awk will select only the relevant fields

Leave a comment