My testcase is a tree
like this:
$ tree -t .
.
├── test2
│ └── db
│ ├── foo
│ └── bar
└── test
└── db
├── foo
└── bar
foo
is the newest file in each directory.
#/bin/bash
# awesome-list-command
for dir in */; do
timestamp=$(find ./$dir -type f -printf "%T@ %t\\n" | sort -nr -k 1,2 | head -n 1)
printf "%s %s\n" "$timestamp" "$dir"
done | sort -nr -k 1,2 | awk '{$1=""; print}'
Output:
$ ./awesome-list-command
Tue Feb 4 23:29:41.0766864265 2014 test2/
Tue Feb 4 23:29:40.0026788568 2014 test/
for comparison:
$ stat -c "%y" test*/db/foo
2014-02-04 23:29:41.766864265 +0100
2014-02-04 23:29:40.026788568 +0100