Cover V03, I03
Article
Figure 1
Figure 2
Listing 1
Listing 10
Listing 11
Listing 12
Listing 13
Listing 14
Listing 2
Listing 3
Listing 4
Listing 5
Listing 6
Listing 7
Listing 8
Listing 9

may94.tar


Listing 7: prog4

:
#######################################################
# prog4 - list all files that have probably not been
# accessed since they were put on the system; that is,
# all files with access time equal to change time.  if
# atime is the same as ctime then it's a good bet that
# no one has used the file.
#
# see prog4a for information on limiting the search; for
# example, only displaying files that have not been used
# in the past six months, in the past two years, etc.
#
# we only need to look at ctime and atime because if
# mtime is changed ctime is changed too.
#
# atime - Time when file data was last accessed.
#         Changed by the following system calls:
#
#     creat, mknod, pipe, utime, and read.
#
# mtime - Time when data was last modified.  Changed by
#         the following system calls:
#
#     creat, mknod, pipe, utime, and write.
#
# ctime - Time when file status was last changed.
#         Changed by the following system calls:
#
#     creat, mknod, pipe, utime, and write,
#         and chmod, chown, link, unlink.

find / -type f -print |
stat -aACn - |
# 2 examples of limiting date range.
# awk "{ if ( \$6 < date ) print; } date=$decimal_date" |
# egrep 1993 |
awk '
{
# day month dayofmonth time year

atime=sprintf("%s %s %s %s %s", $1, $2, $3, $4, $5)

Atime=$6
Ctime=$7

fn=$8

if ( Atime == Ctime )
printf("%s %s\n", fn, atime)
}'
exit 0