[Gllug] Most Recent File
Steve Nelson
sanelson at gmail.com
Tue Nov 22 08:44:14 UTC 2005
On 11/22/05, Simon Faulkner <simon at titanic.co.uk> wrote:
> How would you folks find the most recent file in a folder tree?
Aside from 'most recent' being a little ambiguous - do you mean most
recently accessed? most recently changed? most recently modified? -
the very simple way is with ls!
$ ls -lt | head -5
total 61146
-rw-r--r-- 1 nelsost1 uto 3866 Nov 21 09:26 fdisk-l
-rw------- 1 nelsost1 uto 1111091 Nov 18 16:41
c0n1-bundles-nelsost1.tar.bz2
-rw------- 1 nelsost1 uto 2061676 Nov 18 16:41
c0n0-bundles-nelsost1.tar.bz2
-rw-r--r-- 1 nelsost1 uto 1059 Nov 17 13:38 panic
> Is there a simple way?
Yes!
There are also some nifty arguments you can pass to find (search for
'time' and 'recent' in the manual page).
One of my favourite tricks is to find a file within a specific period
of time... say in the last 48 hours:
touch -t 11200845 timestamp
find . -newer timestamp
> TIA
>
> Simon
S.
--
Gllug mailing list - Gllug at gllug.org.uk
http://lists.gllug.org.uk/mailman/listinfo/gllug
More information about the GLLUG
mailing list