I am looking for parameters to ls
, or something equivalent, that do the following for a specified directory:
For each subdirectory:
- Look at each file and directory it contains, recursively.
- Find the file or directory with the most recent updated/modified date.
- Show this recursive updated date.
- Optionally, sort by this recursive updated date.
Afaik, the regular ls -lArt
command only looks at the updated date of the folder itself, and not at the folder contents.
So, I am looking for an equivalent to what du -hs * | sort -h
does for file size.
Example
Consider the following directory structure.
- dir
- subdir1: last udpated 2013-07-07
- subdir1a: last updated 2012-01-01
* file1a1.txt last updated 2016-02-22
* file1b.txt: last updated 2016-01-06
* file1c.txt: last updated 2015-12-30
- subdir2: last updated 2016-03-10
* file2a.txt: last updated 2016-02-04
* file3.txt: last updated 2014-02-13
The output for ls-special dir
(sorted) would be like this:
file3.txt: last updated 2014-02-13
subdir1: last updated 2016-02-22
subdir2: last updated 2016-03-10