If you have a version of find
(such as GNU find
) that supports -printf
then there's no need to call stat
repeatedly:
find /some/dir -printf "%T+\n" | sort -nr | head -n 1
or
find /some/dir -printf "%TY-%Tm-%Td %TT\n" | sort -nr | head -n 1
If you don't need recursion, though:
stat --printf="%y\n" *