Page 1 of 1

Find and display most recent files using find and perl

PostPosted: Tue Dec 15, 2009 8:09 pm
by stephen
Find and display most recent files using find and perl
I found this tip at this web site:-
http://www.commandlinefu.com/commands/view/3563/find-and-display-most-recent-files-using-find-and-perl
Code: Select all
find $HOME -type f -print0 | perl -0 -wn -e '@f=<>; foreach $file (@f){ (@el)=(stat($file)); push @el, $file; push @files,[ @el ];} @o=sort{$a->[9]<=>$b->[9]} @files; for $i (0..$#o){print scalar localtime($o[$i][9]), "\t$o[$i][-1]\n";}'|tail