Find and display most recent files using find and perl

Find and display most recent files using find and perl

Postby stephen » Tue Dec 15, 2009 8:09 pm

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
stephen
 
Posts: 507
Joined: Thu Feb 09, 2006 9:37 am
Location: Brisbane

Return to Linux Server Configuration Notes

Who is online

Users browsing this forum: No registered users and 2 guests

cron