i've been tasked with identifying rarely used files, and while i can do
that with
find . -atime +somenumber -atime -somenumber
it would be cool if i could throw an "-exec somecommand {} \;" on there to
actually show when the file was last accessed.
liam
Under Solaris, use the -u option to ls:
mozi% echo "Hi" >/tmp/foo
mozi% sleep 300
mozi% cat /tmp/foo
Hi
mozi% ls -l /tmp/foo
-rw------- 1 markmont ffive 3 Oct 19 09:54 /tmp/foo
mozi% ls -lu /tmp/foo
-rw------- 1 markmont ffive 3 Oct 19 10:01 /tmp/foo
If, for some reason this does not work for you, the following Perl
hack (warning! no error checking!) will do it:
mozi% perl -e '$t = localtime((stat($ARGV[0]))[8]), print "$t\n";' /tmp/foo
Thu Oct 19 10:01:28 2000
So,
find . -atime <SOMENUMBER1> -atime <SOMENUMBER2> -exec ls -lu {} \;
-or-
find . -atime <SOMENUMBER1> -atime <SOMENUMBER2> -exec \
perl -e '$t = localtime((stat($ARGV[0]))[8]), print "$t\n";' {} \;
Hope this helps.
Mark Montague
LS&A Information Technology
mark...@umich.edu
I've never had reason to print atime before, so i didn't even think to
check the ls manpage. d'oh!
liam