Paul Jungwirth on 11 Apr 2012 08:52:12 -0700 |
[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]
[PLUG] Sort a file tree by last modified time |
Hi All, Does anyone know how to get a list of files (including within subdirectories) sorted by last-modified time? I'm looking for output roughly like this: [Feb 15 13:12] content/code/encc.md [Feb 15 13:12] content/code/solsystem [Feb 15 13:12] content/code/solsystem/solsystem.tar.gz [Feb 15 13:14] content/code/upload [Feb 15 13:15] content/code/upload.md [Feb 29 10:42] content/code/launch4j-maven-plugin.md [Feb 29 10:44] content/code [Mar 23 16:08] content/widget.html I don't really care how the dates are formatted or whether they appear first or last. Bonus points if I can filter by file type (e.g. show just regular files and symlinks) and choose whether to reverse the sorting or not (though that's easy enough by piping to tac). Things I've tried already: ls -ltrR . This gives a separate listing for each subdirectory. I want *all* the files sorted together. Also it doesn't show the full path of things. tree -fiDt . This is *so* close, but it keeps files within a given directory on adjacent lines, and only sorts them within that group. What I really want is to see all the recently-modified files down at the bottom. find . -mtime 7 I don't want to guess about some cutoff point; I want to see all the files. I just want the recently-changed ones to be prominent. This seems so simple, and it's something I've wanted again and again over the years. But none of the standard tools seem to do it. You could almost combine `tree` with `sort`, but the timestamps tree prints aren't consistent (e.g. year doesn't always appear). I guess it's a job for a Perl/Ruby script, but does anyone know an easier way? Thanks! -- _________________________________ Pulchritudo splendor veritatis. ___________________________________________________________________________ Philadelphia Linux Users Group -- http://www.phillylinux.org Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce General Discussion -- http://lists.phillylinux.org/mailman/listinfo/plug