-printf is a Linux exclusive.  Well I guess this is TCLUG.
 
--- 
Wayne Johnson,                         | There are two kinds of people: Those 
3943 Penn Ave. N.          | who say to God, "Thy will be done," 
Minneapolis, MN 55412-1908 | and those to whom God says, "All right, 
(612) 522-7003                         | then,  have it your way." --C.S. Lewis


----- Original Message ----
From: Dave Sherohman <dave at sherohman.org>
To: tclug-list at mn-linux.org
Sent: Wednesday, January 9, 2008 5:30:21 PM
Subject: Re: [tclug-list] Finding the date of the newest file in a directory tree


On Wed, Jan 09, 2008 at 05:20:14PM -0600, Florin Iucha wrote:
> On Wed, Jan 09, 2008 at 04:57:04PM -0600, Dave Sherohman wrote:
> > Not entirely "quick" when dealing with a million files, but
> > 
> > find /some/dir/ -exec ls -l {} \; | awk '{print $6,$7,$8}' | sort
 -r | head -1
> 
> Ewwwww... ETOOMANYLS
> 
> find /some/dir -type f -printf "%h/%f %A@\n" | sort -rn -k2 | head -1

*bows*  Yours is the superior find-fu.  I wasn't even aware it had a
-printf option.

But wouldn't you want %T@ (mtime) rather than %A@ (atime), since we're
looking for the most recently modified file?

-- 
I reckon we are now the only monastry ever that had a dungeon stuffed
 with
sixteen thousand zombies.
  - perlmonks.org

_______________________________________________
TCLUG Mailing List - Minneapolis/St. Paul, Minnesota
tclug-list at mn-linux.org
http://mailman.mn-linux.org/mailman/listinfo/tclug-list






      ____________________________________________________________________________________
Looking for last minute shopping deals?  
Find them fast with Yahoo! Search.  http://tools.search.yahoo.com/newsearch/category.php?category=shopping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.mn-linux.org/pipermail/tclug-list/attachments/20080109/8de764e2/attachment.htm