So here's the deal. Let's say I have a directory named "web", so
$ ls -la
drwx------ 4 rimmer rimmer 4096 2010-11-18 06:02 web
BUT inside this directory, web/php/
$ ls -la
-rw-r--r-- 1 rimmer rimmer 1957 2011-01-05 08:44 index.php
That means that even though the content of my directory, /web/php/index.php has been last modified at 2011-01-05, the /web/ directory itself is reported as last modified at 2010-11-18.
What I need to do is have my /web/ directory's last modification date reported as the latest modification date of any file/directory inside this directory, recursively.
How do I go about doing this?
Something like:
find /path/ -type f -exec stat \{} --printf="%y\n" \; |
sort -n -r |
head -n 1
Explanation: