Operating system: Linux
Filesystem type: ext3
Preferred solution: Bash (script/one-liner), Ruby, or Python
I have several directories with several subdirectories and files in them. I need to make a list of all these directories that is constructed in a way such that every first-level directory is listed next to the date and time of the latest created/modified file within it.
To clarify, if I touch a file or modify its contents a few subdirectory levels down, that timestamp should be displayed next to the first-level directory name. Say I have a directory structured like this:
./alfa/beta/gamma/example.txt
and I modify the contents of the file example.txt
, I need that time displayed next to the first-level directory alfa
in human readable form, not epoch. I've tried some things using find, xargs
, sort
and the like, but I can't get around the problem that the filesystem timestamp of 'alfa' doesn't change when I create/modify files a few levels down.
-0
option to use withfind
's-print0
– Setaa