Reputation: 71
I am trying to retrieve list of files inside a (unix) directory , I want to retrieve the files along with modified date
ls -LR retrieve the files for me , but I need the modified date alone with it how do I do it ?
Upvotes: 0
Views: 1135
Reputation: 204731
Use find -type f -printf "<whatever>"
to print the file name plus modification date or anything else you want to know about the file. man find
.
Upvotes: 0
Reputation: 11713
Using tree
tree -D
Quoting from man tree
-D Print the date of the last modification time or if -c is used, the last status change time for the file listed.
Test
% tree -D
.
|-- [Oct 19 20:20] dir1
| |-- [Oct 19 19:49] file1
| |-- [Oct 19 19:49] file2
| `-- [Oct 19 19:49] file3
`-- [Oct 19 20:20] dir2
|-- [Oct 19 20:20] file1
|-- [Oct 19 20:20] file2
`-- [Oct 19 20:20] file3
2 directories, 6 files
Using ls
followed by awk
ls -lR | awk '$9 {print $6, $7, $8, $9}'
Test
% ls -lR | awk '$9 {print $6, $7, $8, $9}'
Oct 19 19:49 file1
Oct 19 19:49 file2
Oct 19 19:49 file3
Upvotes: 1