/ Published in: Bash
Find the most recently modified file in a directory tree and output its name and modification time. Use index 8 or 10 instead of 9 for access and inode modification time, respectively (see perlfunc manual page - function stat).
This is great for deciding what directories to backup.
This is great for deciding what directories to backup.
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
find directory -type f | perl -e 'my $l=0; my $n=""; while( <> ) { chomp; my $t= ${[stat($_)]}[9]; $t > $l and ($l= $t, $n= $_); } print "$n\t".localtime($l), "\n";'