
1. Find files that have not been accessed for a specified number of days and list them in a file. The following example locates regular files in /var/adm and its directories that have not been accessed in the last 100 days and saves the list of inactive files in /var/tmp/deadfiles.
# find /var/adm -type f -atime +100 -print > /var/tmp/deadfiles & # more /var/tmp/deadfiles /var/adm/aculog /var/adm/spellhist /var/adm/vold.log /var/adm/messages.0
2. Remove the inactive files with the rm command.
# rm `cat /var/tmp/deadfiles`
Additional note:
# find directory -type f[-atime + nnn] [-mtime + nnn] -print > filename
directory – Directory to check.
-atime +nnn – Finds files that have not been accessed within the number of days.
-mtime +nnn – Finds files that have not been modified within the number of days.
+nnn – Number of days.
filename – File containing the list of inactive files.
