Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Recursive file list sorted by date
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks
View previous topic :: View next topic  
Author Message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Tue Jun 05, 2007 11:26 am    Post subject: Recursive file list sorted by date Reply with quote

I have long been looking for a way to recursively list the files in a directory and sort by date. ls -lR lists files recursively, but does not enable sorting by date. Here is a solution that I just found using find:

Code:
LC_TIME=en_DK.UTF-8 find . -type f -printf '%Tx %TX %p\n'|sort


The locale setting formats the date as YYYY-MM-DD.
Back to top
View user's profile Send private message
bludger
Guru
Guru


Joined: 09 Apr 2003
Posts: 389

PostPosted: Tue Jun 05, 2007 11:45 am    Post subject: Reply with quote

If you don't have the en_DK locale installed, you can manually format the date as follows:

Code:
find . -type f -printf '%TY-%Tm-%Td %TH:%TM:%TS %p\n'|sort
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Documentation, Tips & Tricks All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum