Linux ls – How to Recursively List All Files with Timestamps and Full Path

linuxls

I want to recursively list all files in a given directory, with their full path and their timestamps. Something like this:

10:30 Dec 10 2010 /tmp/mydir/myfile

I've tried with:

find . -type f -exec ls -la {} \;

but that doesn't give me the full path.

Best Answer

And another way to do it if your find doesn't support printf

find . -type f | xargs ls -al  | awk -v pwd="$PWD" '{ print $(NF-2), $(NF-1) , pwd substr($(NF), 2)}'  

Note: This only works as long as there aren't any spaces in the filenames. Output looks like this:

2010-09-29 22:08 /home/nifle/ac.txt
2010-10-04 16:02 /home/nifle/array.sh
2010-10-05 23:32 /home/nifle/b.txt
2010-12-15 16:49 /home/nifle/barcopy/subbar/ghut
2010-12-15 16:48 /home/nifle/bardir/subbar/ghut
2010-09-29 22:16 /home/nifle/foo.gz
2010-09-29 22:16 /home/nifle/foo1.gz