Find Newest Files Recursively in Linux

We had an old directory on a server that had been backed up offline, as we had moved all of the files within the directory to a cloud server. But before I deleted the entire directory, I wanted to verify the last date of the files, to see if anything new had been added somehow.

To do this, I simply ran the following:

find . -type f -printf "%TD %TT %p\n" | sort -rn | head -n 10

This gave us results like the following:

12/31/12 17:58:29 ./265080/_Invoice_20130311151.pdf
12/31/12 17:58:28 ./265080/xComplianceCertificate.pdf
12/31/12 17:55:51 ./264253/Invoice.pdf
12/31/12 17:54:10 ./264253/264253_freddie.pdf
12/31/12 17:54:06 ./264253/264253_fannie.pdf
12/31/12 17:48:27 ./264917/264917_freddie.pdf
12/31/12 17:48:23 ./264917/264917_fannie.pdf
12/31/12 17:43:36 ./264657/Invoice.pdf
12/31/12 17:43:35 ./264657/xComplianceCertificate.pdf
12/31/12 17:42:26 ./264657/264657_freddie.pdf

I could then see the oldest file was from December of 2012.

Hope this helps someone. For more information on `printf`, look here:

Posted in Linux